0
votes

I have a TCP Socket Client (using the Socket Class) that is connected to a simple TCP socket server (just for testing) I have this code snippet :

Dim aSocket as Socket
While aSocket.Connected = True
                     byteRead = aSocket.Receive(dataByte) 'number of bytes
                    'checking the number of bytes
                    If byteRead > 0 Then
                        data = System.Text.Encoding.ASCII.GetString(dataByte, 0, byteRead)
                     End if

Do Processing
                data Nothing
                byteRead = Nothing
end while

I have also a procedure that is checking the connection state and try to reconnect and do the working stuff...After try to reconnect on a new socket and reading data i receive a message error on this line : byteRead = aSocket.Receive(dataByte) 'number of bytes "An existing connection was forcibly closed by the remote host“

I have perform some searches on the internet but i did not find anything. Could be related of the way of reading data?

1

1 Answers

0
votes

I have found the problem...some TcpSocket.Close() called in some function...