質問

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?

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top