In my scenario i ran a script which schedules files repeatedly,my application do some computations and sends response to client ie client is making a repetitive http call to get the response of each file.When around 150 files are scheduled socket ports in my server goes in time_wait state and their count exceeds thousands and an exception is thrown in client which opens a http connection ie
Error : [Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted
The result was that my application hanged.I do not know may be threads have gone in wait state or what has happened but i need to kill all processes or restart my application to make it work again.
I tried reducing wait time to 30 seconds since it is 240 seconds by default but it did not work.
Is there any way i can reuse those ports that are gone in wait state?
Would this property make any difference if i add it in client code when it opens a http connection?
http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = numCoroutines
took reference from this answer
Have very less idea about sockets.Please guide!!