What makes you think it's still connected? What is sysread returning? 0? undefined? If undefined, what's in $!? | [reply] [d/l] [select] |
It returns an integer 0 from the sysread function but loads undef into the buffer that sysread stores the data in. I think it is still open because the app never closes it. Maybe I am missing something but this socket is suppose to remain open so I assumed it was since the only one I close is the client socket.
| [reply] |
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.
| [reply] [d/l] [select] |
Sorry, without having something I can run myself, I've exhausted my ideas.
| [reply] |