开发者

Identify connection lost between Socket Server and Socket Client in VB.Net

Friends,

I wrote a Socket Client which will send the Socket Server some data and get some response from Server. This process will be running once in every 2 seconds.

Now what I need to know is How we can identify the connection lost between Server and Client?

I need this to be implemented in the Client side. If there is no connection then Client should automatically close the connection. Once the connection with t开发者_Go百科he server is available in the next attempt it should connect automatically.

Thanks in advance!


I'm not a vb.net developer, but this is how it works in most languages.

Writing to a lost/closed connection will fail, the client will then know that he needs to reconnect.

It's never possible to know if a connect attemt to a server will succedd before you have done it, so your client should try to reconnect in a loop with a sleep/wait period in between each connection attempt.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜