0

Good day everyone. I wrote a simple java.net server example - initially (I am at the beginning of the learning curve, so please bear with me) I used port 8080 for both client and server, but then I learned that it's not always safe to assume that port 8080 was available, so I am using new ServerSocket(0), that in my understanding should find an available port. The problem is that this server once started will wait for a connection from a client, that I also wrote using in this case node:net .. but net.createConnection requires a port number that obviously needs to match the one used by the server: is there a way for the server to share the port used with the client? Thanks! Erminio

  • Ah, I see: https://stackoverflow.com/questions/22917438/with-ipc-how-to-tell-client-which-port-the-server-is-listening-on/22919509#22919509 . Question answered, thanks. – ErminioB Jun 01 '23 at 18:11

0 Answers0