Dear all,
 
I am using HttpClient for a program to connect to a Webserver, I am
testing now and run many connections (short one) to a Webserver with
maximum 20 threads of HttpClient(s) at the same time to connect to a
Webserver in the same computer. And I found that many times a HttpClient
cannot connect to a Webserver because the port is already use by another
Webserver. I am wondering why this happen, and I think using 20 thread
in the same time means I only use 20 ports (and another 20 ports use by
the Webserver) at the same time and there is still a lot of ports in my
computer that HttpClient can bind but still HttpClient often throws
exception because trying to bind already bound Socket. So my question
are :
 
1.      Is this happen because the "bad management" of port allocation?
2.      And what is the best way to deal with this?
 
Thank you very much.
 
Rahmat Bagas Santoso

Reply via email to