0

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 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.