TCP Port Reuse After Closing

After closing a TCP port there is a period in which a new connection can not be opened again. This is due to the TIME_WAIT state in the TCP protocol.

This article, titled “TIME_WAIT and its design implications for protocols and scalable client server systems”, explains the issue very well. As a quick solution, the flag SO_REUSEADDR can be used when opening a new socket. Though it does not really release the resource it occupies.

 

 

Advertisements

About minghuasweblog

a long time coder
This entry was posted in All, C/C++ and tagged , . Bookmark the permalink.

One Response to TCP Port Reuse After Closing

  1. Pingback: Network IO Code | minghuasweblog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s