Checking for a closed connection

AndreRyan

Junior Contributor
Joined
Jan 23, 2002
Messages
366
I've got a TcpClient class and I used the System.Type system to forge a connection to the Socket property, I'm using the Poll command but SelectMode.SelectRead returns True on data arrival as well so is there another way to check or can you filter out to see if it's a data arrival or the connections closed.
 
I figured it out:
Visual Basic:
If sock.Poll(10000, SelectMode.SelectRead) = True AndAlso sock.Avaliable = 0 Then
If there is 0 Avaliable data then it's a "Cconnection close" notification
 
Back
Top