Is there any way for my TCP/IP listener to detect if there are currently conencted client?
This is my code:
Public Sub StopListen()
client.Close()
tcpClientThread.Abort()
server.Stop()
SyncLock accessLock
endThread = True
End SyncLock
Btn_Listen.Text = "Listen"
End Sub
The problem in that code is whenever the user pressed the Stop Listen
button and there are currently no cients connected to my listener an error occurs.
How can I do something like this?
Public Sub StopListen()
If thereIsConnectedClient Then
client.Close()
End If
tcpClientThread.Abort()
server.Stop()
SyncLock accessLock
endThread = True
End SyncLock
Btn_Listen.Text = "Listen"
End Sub