good chemistry is complicated,
and a little bit messy -LW
Win32 sockets and disconnectsby HaB (Sexton)
|on Dec 13, 2000 at 01:33 UTC||Need Help??|
HaB has asked for the
wisdom of the Perl Monks concerning the following question:
I have a little situation here I thought some of you might be able to shed some light on. I have a socket server/client combo running. The server I wrote myself, but the client is someone else's. (That may be important, I dunno). Here is the basic problem:
Both are designed to be run in the field, using the Internet as a method of connecting, so in order to simulate various problems, we have been fooling around with a couple of ways to disrupt the connection to see if the server will detect that, and cycle itself. (Which is what it's designed to do).
For the first test, we start a batch send on the client, let it begin, and yank the network cable.
Everything's fine. The server discards the incomplete message (if any), and cycles itself. Plugging the cable back in has the desired effect of the client continuing where it left off. All fine and dandy.
For the second test, we start the batch send, and Ctrl-C the client program. The server again registers the disconnect, and cycles itself. The problem starts when we then restart the client. The client comes up and says it makes a successful connection, and begins sending data again. The server, however, never registers a connect at all. It just sits listening. Since the client waits for an ACK message from the server between each message it sends, it gets stuck waiting for an ACK on a message that according to the server, never got there in the first place. The server never sends a NACK because it never even registers the connection attempt.
I am really unfamiliar with sockets under win32 anyway, and it's been a while since programming them on *nix.
Any thoughts? Ideas? Suggestions?
Here's the code where it's stopping (and the surrounding code):
The create_socket routine prints a message about succesfully creating the listen socket, and returns, that's where we appear to be stopping...(I'm getting the "server cycled" message.)
Anything would be much appreciated.