Socket closed causes problems

H

hermbagger

I have an async socket server running. When a connected client closes
the connection, the servers' OnDataReceived function seems to get
bombarded with empty messages (0 bytes) It causes the entire server
to hang until an exception is thrown and the socket gets released.
How can I handle this situation? No method of checking for message
length or message content seems to be able to kill the connection in
time because the bombardment is so rapid.

Has anyone else had this problem?
 
S

Steve Ricketts

Actually, I just had the same thing happen in the client when I closed the
server. I tried checking for theSockId.thisSocket.Connected but it
continues to return "true". I am able to check the value of
theSockId.thisSocket.EndReceive(asny) and if it's 0 I can close but this
doesn't seem like a very elegant way to determine if a connection was
closed.

If anyone has some insight on this, it sure would be appreciated.

sr
 
S

Steve Ricketts

Really?... who would have thought! ;-)

Thanks so much for clearing that up.

sr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top