Slusher, Jessica (LNG-DAY) wrote: > I have an application that makes a socket connection early on and uses > that connection throughout its processing. The problem I am running > into is that sometimes the app can run a long time and if the connection > becomes stale (because the other side died while the app was busy on > something else) the app fails. > > > > What I want to do is add some kind of check to make sure the connection > is still alive before I use it. If it is stale I can reconnect, but I > won't be forced to reconnect each and every time. Is it possible to > check the health of the socket connection in Perl?
Try setting the REUSE_ADDR flag : Set Reuse => 1 if using IO::Socket or $fh->setsockopt(SOL_SOCKET, SO_REUSEADDR, 1); or setsockopt (LISTEN, SOL_SOCKET, SO_REUSEADDR, 1); depending on how you open the socket. -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff) _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs