Hi,
Anyone knows how in socket programming to make a client connects to a server with specific local port ?
 
I mean if the server provides port 1000.. i wanna make my client connect to the port 1000 in server side using port 5000 in client side.
I have been looking in the Socket class in the API but looks like no method for that.
 
I was trying to use Socket(InetAddress address, int port, InetAddress localAddr, int localPort) in client side. I use 5000 in the int localPort. But when i try to print.out what port that the client using in server side using Socket.getPort() method, i got diffrent value. Its not 5000 but others and always changing everytime i restart the client.
 
Is there something that I missed ?


==
thx,
a Java Addicted

Reply via email to