On Friday, May 3, 2002, at 11:05 , Keddie, Diane wrote: [..] > > my $close=close($sock); > > The socket connection works, and we get the appropriate information back > from our mainframe scripts. However, the return value from close($sock) > is > 1 with "Bad file number" in $!. Should we be concerned that the socket > connection is not closing properly and could cause other problems? > > --Diane
wow - that is mostly sorta like an issue.... when you do the variation of netstat -naf inet | grep 99 do you find that the port on your host is in say a FIN_WAIT state or any of that??? which can be annoying. So it could be as simple as the file handle has been rudely closed by the far end - or you have really skanked $sock inside of your while loop - not as probable.... What you may wish to do is use the shutdown() as a part of both sides of the socket - so that they do the close of the socket a bit more politely - and brief their respective kernels that they are not planning to do any more BizNiz on this file descriptor and hence to toss any kernel buffers associated with the fd. what I did was wrap all of that in one place: sub dtk_closeSocket { my ( $dtk_sock ) = @_; shutdown($dtk_sock,2); # tell the other end we are outahere close($dtk_sock); } this way both sets of kernels are aware that we are not at all interested in what they had left in any kernel buffers - so I of course didn't think about what the return on the close would be - because, well, I just clearly did not care one way or the other. I of course had already done the unless ( setsockopt($dtk_sock, SOL_SOCKET, SO_REUSEADDR,1) ) { die "Unable to set socket\n"; } so that that we could close out on our side and reuse the port. This of course lead to pushing that stuff into my first perl library - before I 'got' perl modules. since what you are doing seems so close to being the stock uri schema - have you thought about getting the libwww-perl and saving yourself some of the heart ache of doing socket level management? cf: perldoc LWP::UserAgent ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]