Daniel Rychlik wrote: > Guys, > > How would you set a timeout on a TCP connection? > > I have been playing with the idea of using IO::Socket to execute > commands on remote machines. > > On the listening side of the connection, I respond back to the client > with an "OKAY" for the client to send its remote command to the > server... But this brought up the question, what if I never get a > response back through the TCP connection? > > I saw this in the client constructor but Im not able to get it to > work.... > > my $socket = IO::Socket::INET->new(PeerAddr => $remote_host, > PeerPort => $remote_port, > Proto => "tcp", > Type => SOCK_STREAM, > TimeOut => 10)
Try 'Timeout' rather than 'TimeOut' and see if it makes a difference. > If the timeout limit is reached, with the client terminate? I think it only affects accept and connect. > Is the value of TimeOut in the constructor stating "TimeOut is 10 > seconds?" Timeout is in seconds and may be fractional (eg: .010) It's basically used to call the 4 arg select function in IO::Select. _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
