Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: IO::Socket recv and send

by roboticus (Chancellor)
on Mar 26, 2019 at 12:34 UTC ( [id://1231699]=note: print w/replies, xml ) Need Help??


in reply to Re^2: IO::Socket recv and send
in thread IO::Socket recv and send

PublicAccess:

Error checking code often adds a bunch of visual clutter to code. It's all a matter of which tradeoffs you want to make.

Checking before each send()/recv() is pretty good, but (as you mention) adds clutter. Worse, it won't always work, as you could be disconnected between the check and the following call.

You could also check only after you receive a null, but only works for recv().

You mention that in C you could check for SIGPIPE, so if it meets your needs in C, why not use it in your script? The perlvar documentation for %SIG shows how to create a signal handler.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-16 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found