in reply to How time out can be done here?

You should look at using the "alarm" function to setup a timed alert - which can then be caught using eval.

You don't give much sample code, but this might be a good starting point:

# # Create a listening socket. # # # Never exit. # while (1) { # # Wait until we have an incoming connection # next unless $data = $main_socket->accept(); # # This eval block is here so that were can prevent DOS # attacks by closing sockets if there's nothing received. # after a while. # eval { # ten seconds. alarm( 10 ); # read data $data->recv ($text,1000); # cancel timeout alarm( 0); }; if ($@) { if ($@ =~ /timeout/) { # Timed out. Close socket. Exit. close($data); print "Timed out.\n"; } else { # normal exit close( $data ); } } }
Steve
--