Wednesday 15 April 2015

Setting source port on a Java Socket? -


I am very new to socket programming:

Is it possible to explicitly set source port Is on the java socket?

I am working on a client / server application in which the client can probably listen for answers from the server on multiple ports. It would be good if I set this reply port on the client side when starting the socket, so that the server should be able to determine which port to answer on the other side.

Yes, use the method. It mirrors the function available in the highest-level socket implementation. Note that you can not independently choose which port to use on a port, some categories are considered reserved and off-cement for user applications.


No comments:

Post a Comment