I'm developing a torrent with Java and there is a small question I have. How can I get an open socket for my process in java? I need about 100 free sockets in a sequence, just like 10000-10100. All I know is that by using
socket = new Socket(ip, port);
We need to provide ip and port. Well of course this is the case of debug and my ip is loopback, but I could find only one free port by using random numbers in port field. Please tell me how to find a sequence of free ports for tcp.