in reply to socket problem? script hangs occasionally...
It would be a good idea to do your print immediately before the send it is explaining; that way it acts as a trace. Wrapping the print/send pair up in a sub will also help you avoid repeating yourself too much. And more prints everywhere for tracing wouldn't hurt either.
printf ("%s\n", 'stuff') if DEBUG_LEVEL > 0 is handy since you can turn it off with one constant and have it still there in case things go wrong later.
I don't see where you test to ensure the socket is writable before you attempt to send, and readable before you read.
I would also suggest packing up the whole message into a string before doing a single send. Fewer places for things to go wrong that way.
Lastly, does the phabrix device perhaps expect a line terminator that you are not providing? If so, it would sit and wait; your buffers would fill up and your reads & writes would start blocking.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: socket problem? script hangs occasionally...
by bgervais (Initiate) on May 03, 2013 at 20:19 UTC |