Cannot assign requested address issue

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.