Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

vek (2312)

vek
  (email not shown publicly)

Journal of vek (2312)

Thursday May 16, 2002
05:40 PM

Socket Deadlock

[ #4976 ]

Yippee - I got to work on some Perl code today. Unfortunately it was a bug report with the ever helpful description of "well it just hangs and doesn't return anything to the screen".

I suspected the socket code might be to blame. The program in question is one of our Credit Card daemon's. So I asked if the remote client had been modified (it had) so then I asked if the client socket code had been modified (it had). So I get to this snippet of code in our daemon and just sighed:

while (<$sock>)

No, please don't do that. It's no wonder you're in I/O blocking hell. So a quick rewrite with IO::Select and sysread fixed things up nicely.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.