Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: socket lost by buffer overflow

by elwarren (Priest)
on Dec 22, 2004 at 00:07 UTC ( [id://416657]=note: print w/replies, xml ) Need Help??


in reply to socket lost by buffer overflow

You should check the return of the print to your socket for undef. This means the other end of the connection is gone. You don't have any code, so this is just my assumption. Change your code to do something like this:
my $sockstatus; while (<YOURLOOP>) { $sockstatus = print $socket $data; last unless $sockstatus; }

hth!

Replies are listed 'Best First'.
Re^2: socket lost by buffer overflow
by jfroebe (Parson) on Dec 22, 2004 at 06:37 UTC

    Hi :-)

    Dug's method will handle when the os notifies us when the tcp keepalive mechanism determines that the client is no longer there if the client doesn't close the tcp connection itself.

    elwarren's method will proactively perform a 'ping' to the client to determine if the client is no longer there.

    Which to use? Depends if you when you need to know when a client connection disappears. Do you really need to know if it disappears within 10 seconds?

    IMHO, a connectionless (udp based) would be preferrable. There is a simple example in the Perl Cookbook IIRC.

    Jason L. Froebe

    Team Sybase member

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

      The problems seal3 is seeing is on writing to a socket, not reading from it. I just posted the simplest solution.

      seal3 can you show us your code?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://416657]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-25 20:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found