TcpListener.AcceptTcpClient

Drstein99

Junior Contributor
Joined
Sep 26, 2003
Messages
283
Location
Audubon, Nj
I'm using a thread to listen for new tcpclients. It looks like the operation just sits idle and waits for new connections and then continues.

How can i gracefully halt a "listener.AcceptTcpClient" operation?
--------------
Also, I am finding throughout the program, i can't stop or re/start the listener socket its throwing exception 10048 "WSAEADDRINUSE" - which means that address is in use by another listener.

how can i grab ahold of the original one and / or shut it down, dispose, finalize, etc....?
 
Last edited:
I've changed my code to loop through (its a thread). when pending =true it calls the accepttcpclient.

However, the program still operates the same. It only occurs on the windows 98 test platform, where vs.net isnt loaded. I'm developing on a windows xp platform.
 
it appears as if my command to call when the READ buffer is populated:

Me.client.GetStream.BeginRead(readBuffer, 0, READ_BUFFER_SIZE, AddressOf StreamReceiver, Nothing)

IS still executing after i closed the client:

client.close

for some reason. it was still open. I have made the following changes, and has made my program run smoother, without the 100048 violation:



client.GetStream.Close()
client.Close()

(when i close connections, and logout - and then decide to log back in)
 
Back
Top