Commit e92a7fe5 authored by Gabriele Civitarese's avatar Gabriele Civitarese

Fixed datagram packet reading

parent 96c30153
......@@ -35,7 +35,7 @@ class UDPClient {
/* Riceve il pacchetto dal server */
clientSocket.receive(receivePacket);
String modifiedSentence = new String(receivePacket.getData()).trim();
String modifiedSentence = new String(receivePacket.getData(), 0, receivePacket.getLength());
System.out.println("FROM SERVER: " + modifiedSentence);
clientSocket.close();
......
......@@ -23,7 +23,7 @@ class UDPServer {
/* Riceve un pacchetto da un client */
serverSocket.receive(receivePacket);
String sentence = new String(receivePacket.getData());
String sentence = new String(receivePacket.getData(), 0, receivePacket.getLength());
/* Ottiene dal pacchetto informazioni sul mittente */
InetAddress IPAddress = receivePacket.getAddress();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment