Define a public variabl mbol_Shutdown. Next when you are ready to shut the
socket down, assign the global mbol_Shutdown variable to True and signal the
System.Threading.ManualResetEvent "mobj_ListenResetEvent"
(mobj_ListenResetEvent.Set()). This should allow you to break out of the
loop.
While True
mobj_ListenResetEvent.Reset()
mobj_Socket.BeginAccept(New AsyncCallback(AddressOf
AcceptCallback), mobj_Socket)
mobj_ListenResetEvent.WaitOne()
If mbol_Shutdown then Exit While
End While
'clean up