test for a simpleTCPSocket program,ClienttoServerrequests that a connection be established and then released.
two simultaneous runs on a single hostClientwhen an error occurs."Cannot assign Requestedaddress"
will beServerthe request processing is changed to3the thread pool of threads is resolved after the problem.
but running at the same timeClientwhen the number continues to increase, such as theaClientrunning at the same time, the problem recurs.
Find the problem analysis on the Internet as follows:
clients frequently connect to servers, because each connection ends in a very short period of time, causing a lot oftime_waitso that it runs out of usable endThe new connection has no way to bind the port, i.e."Cannot assign requested address". The problem with the client is not the server side. Throughnetstatand indeed see a lot oftime_waitState of the connection.
the problem is not visibleServerend, butClientconnection is frequently established and the port is released slowly, resulting in no ports available when a new connection is established.
Solutions on the Web:
The execute command is modified as follows2Kernel Parameters(RequiresRootpermissions)
Sysctl-w Net.ipv4.tcp_timestamps=1Open forTCPsupport for time stamping,If the item is set to0, the following setting does not work
sysctl-w net.ipv4.tcp_tw_recycle=1 means open TCP in the connection time-waitsockets fast recovery.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Cannot assign requested address issue