I have a VB.NET 2005 client and server applications using TCP/IP; the
applications are working as expected with the server accepting a client
connection and creating a thread to handle communications with the client.
However when the client application closes the thread on the server side
never becomes aware of this, I was expecting an exception to be thrown in
that thread that I could then use to close the thread down.
On the client side I have the following code to close the connection
(mClient is tcpClient object and mListenerThread is a handing communications
from the server):
If mClient Is Nothing = False Then
Dim oStream As NetworkStream = mClient.GetStre am()
oStream.Close()
mClient.Close()
End If
If mListenerThread Is Nothing = False Then
mListenerThread .Abort()
mListenerThread .Join()
End If
I have searched for an answer but closing both the NetworkStream and the
tcpClient was the only solution I found and it is not working for me.
Any suggestions please?
Sid.
applications are working as expected with the server accepting a client
connection and creating a thread to handle communications with the client.
However when the client application closes the thread on the server side
never becomes aware of this, I was expecting an exception to be thrown in
that thread that I could then use to close the thread down.
On the client side I have the following code to close the connection
(mClient is tcpClient object and mListenerThread is a handing communications
from the server):
If mClient Is Nothing = False Then
Dim oStream As NetworkStream = mClient.GetStre am()
oStream.Close()
mClient.Close()
End If
If mListenerThread Is Nothing = False Then
mListenerThread .Abort()
mListenerThread .Join()
End If
I have searched for an answer but closing both the NetworkStream and the
tcpClient was the only solution I found and it is not working for me.
Any suggestions please?
Sid.