in reply to Re^4: EOF being read from open socket?
in thread EOF being read from open socket?
You have no else block on the if (sysread($ircsock, $ircdata, 512)) { block, so you don't handle the case where the server closes the connection at all, which results in exactly the loop you're seeing.
As to why the server would close the socket when one of your clients disconnects, that may be because of the way the client is disconnecting. Most IRC clients will send a QUIT command to the server when they're about to disconnect, and I wouldn't be surprised if this causes the server to actively close the connection.
Since you don't do any special processing for the QUIT command, I suspect that as soon as one of your clients exits it will cause the server to close the connection to your "proxy". A possible workaround would be to intercept all QUIT commands and just ignore them.
On an unrelated note, I think your usage of sysread will get you into trouble. After each sysread you appear to expect that the result of a successful read will be a complete line. However there's nothing preventing sysread from returning half a line, or two lines at once.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: EOF being read from open socket?
by Elijah (Hermit) on Aug 24, 2006 at 12:48 UTC | |
by Crackers2 (Parson) on Aug 24, 2006 at 14:04 UTC |