A
Andreas Håkansson
Hello,
I'm building a small TCP based server which uses the Async commands. When
a new connection is made to the server, I store the new socket in a
hashtable,
using the client IP as the key.
Then I have a method in my server which is called Stop(). Now I would like
for
some advice on how to close down the server in a gracefull manner. I tried
the
following (Note: pesudo code not VB.NET
ForEach ClientSocket In The HashTable
ClientSocket.Shutdown(SocketShutdown.Both)
ClientSocket.Close()
Remove the ClientSocket from the HashTable
End ForEach
Server.Shutdown(SocketShutdown.Both)
Server.Close()
However when I do this, the Server.Shutdown(SocketShutdown.Both) call throws
an exception telling me I tried to do something on a socket which is already
connected.
Suggestions, solutions etc for a gracefull shutdown schema is welcome =)
//Andreas
I'm building a small TCP based server which uses the Async commands. When
a new connection is made to the server, I store the new socket in a
hashtable,
using the client IP as the key.
Then I have a method in my server which is called Stop(). Now I would like
for
some advice on how to close down the server in a gracefull manner. I tried
the
following (Note: pesudo code not VB.NET
ForEach ClientSocket In The HashTable
ClientSocket.Shutdown(SocketShutdown.Both)
ClientSocket.Close()
Remove the ClientSocket from the HashTable
End ForEach
Server.Shutdown(SocketShutdown.Both)
Server.Close()
However when I do this, the Server.Shutdown(SocketShutdown.Both) call throws
an exception telling me I tried to do something on a socket which is already
connected.
Suggestions, solutions etc for a gracefull shutdown schema is welcome =)
//Andreas