سؤال

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