I use Java (although I think the socket options are implemented in most languages) to implement the client and server. The server sends data to the client for processing, which the client confirms. On another port, the client sends the processing results back to the server. When it comes to options like
- SO_LINGER
- SO_KEEPALIVE
- SO_NODELAY
- SO_REUSEADDRESS
- SO_SENDBUFFER
- SO_RECBUFFER
- TCP_NODELAY
We noticed that the connection between the client and server breaks from time to time. There will be a waiting time for sending or receiving. When this happens, kill the socket and open a new one to continue.
What will be the best options for determining, taking into account the above scenario, and is there anything that we could do on our part (programmatically or in different ways) to try to minimize the number of disconnections of the connection. We use regular TCP / IP.
UPDATE: It will come soon. I have not yet had a satisfactory answer, but it is still open. I think that everyone does not have the goal of the quest. What is the best practice regarding the above options for sockets that are constantly chatting. I already have a ping package in case there is no work (hardly ever in the script), a normal message is sent without internal elements, so processing is always performed.
source
share