Home > Software engineering >  Winsock connection more customers, long time no news will automatically disconnect? How to solve?
Winsock connection more customers, long time no news will automatically disconnect? How to solve?

Time:10-06

Winsock connection more customers, long time no news will automatically disconnect? How to solve? Officer of many words, send message to keep the connection way may result in a data block, can't think out a good way, which have good method

CodePudding user response:

Then use UDP test under

CodePudding user response:

Broken let client automatic reconnection, is TCP protocol? Disconnects the client should also triggered the Close event

Send message to keep the connection way, you can do not regularly from the client to send the service side hair message, so if all data blocks, you should add server,

CodePudding user response:

Regularly check the state condition, close close, close automatically connect

CodePudding user response:

Server and the client should be regularly send heartbeat packets verification link is valid
TCP is long time no news will automatically disconnect routing Settings in the default setting is part of the route

CodePudding user response:

Use the server to the brand licensing, can limit the maximum number of connections n,
A) a fixed port used to register the client, the client startup sends a online news, then immediately close the connection, the server received a postscript in the client list,
B) limited n port open to accept the client message,
C) the service side open timer, if there is a free port, is removed from the client list a (according to the circular loop), assigned to a port, send message,
D) the client after receiving the license, the connection port, data can send data, without data online reply, close the connection,
E) server according to the conventional processing data or online reply, marker for free port, enter the step c,
F) the server if after a certain period of time not received reply, concludes that the client is offline, delete from the list, marker for free port, enter the step c,
  • Related