I have a server and client communicate by using TCP socket and they are separated by a firewall. Everytime the client sends back msg, it open a random port that cannot make it through the firewall. How can I restrict the port it opens? TIA
posted 12 years ago
Hi, How come it opens a random port? A socket can take the port number as an argument when you create it: Socket s = new Socket(String host, int port); there are plenty of other constructors for the Socket class found in the api. are you telling it to create a random port? code would be nice to understand your situation better.