Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
mine appllication communicates with an host via TCP/IP; it reads a writes data on polling through a socket (VB.Net).

If the connection goes outrage, in case of unplugged cable e.g., the read or write operation return me a "false" state and an exception on the socket.
What is the correct operation to do for test periodically the connection, then resetting the last socket and making another istance of the tcpclient?

Any suggested code (VB.net) will be appreciated...
thanks
test the connection, as:
VB
Try
if Socket.Connected then 
Socket.Close
Socket = New TcpClient(..)
Socket.Connect
Catch
socket.close
Socket = new TcpClient
Socket.connect
Finally


What I have tried:

see the body of message, please... no more characters.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900