Question

I am beginner of socket programming. I want to open "closed port", i can listening port like

serverSocket = new ServerSocket(port);

What is the difference between listening / open port and how do i open port. Anyone can help?

Était-ce utile?

La solution

You can't open a port with Java. It's a firewall operation. You can listen at a port, which your code sample exemplifies, or you can connect to it, by constructing a new Socket(...) with the appropriate hostname:port parameters.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top