hello every one
I'm trying to design a program.It 's like a messenger but haven't a chatroom.you can write your sentence and the server should send it for the client that you want?I don't know how server should change the port.I think server's port should be the same as client port (the client that receives the messege),so each time the server's port should change.how should I do this?

I'v e got another question :
shold I close welcomeSocket(it's a serverSocket that accepts client)
when I put this statement :"Socket connectionSocket = welcomeSocket.accep()"
in aloop,exception ocurred if two client are running(the Exception is something like this:the address in used by JVM

can anyone send me some sample code (I don't want java chatroom.I want private chat)

please help me