I\'m programming an Server-Client Software, where the client connects to the server with an port request, the server opens a new port and sends back the new port number. Then th
inD = in.getData();
This merely reasserts the same value. Remove.
message = new String(inD,0,inD.length);
Wrong. You're ignoring the actual length of the received datagram. Change to:
message = new String(in.getData(), in.getOffset(), in.getLength());