When shutting down a TCPListener should Server (the socket) be evaluated for a connection? If a connection exists should Server Shutdown, Disconnect, and Dispose be carried out before stopping the TCPListener?
sample:
If theTCPListener IsNot Nothing Then
Try
If theTCPListener.Server IsNot Nothing Then
If theTCPListener.Server.Connected Then
theTCPListener.Server.Shutdown(System.Net.Sockets.SocketShutdown.Both)
theTCPListener.Server.Disconnect(False)
End If
theTCPListener.Server.Dispose()
End If
p_TCPListener.Stop()
Catch
End Try
End If