From a17960ffc04f65c706da47dde041ef3d348f84c9 Mon Sep 17 00:00:00 2001 From: Sebastian Rieger Date: Wed, 15 Nov 2017 17:45:45 +0100 Subject: [PATCH] clarified meaning of delay in UDPTimeCounterClient --- .../socket/simple/UDPServer.java | 59 ++++++++++--------- .../timecounter/UDPTimeCounterClient.java | 2 +- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/VerteilteSysteme-Examples/src/verteiltesysteme/socket/simple/UDPServer.java b/VerteilteSysteme-Examples/src/verteiltesysteme/socket/simple/UDPServer.java index 7adc86f..1be8961 100644 --- a/VerteilteSysteme-Examples/src/verteiltesysteme/socket/simple/UDPServer.java +++ b/VerteilteSysteme-Examples/src/verteiltesysteme/socket/simple/UDPServer.java @@ -1,29 +1,30 @@ -/* Angelehnt an Kurose/Ross Computernetzwerke (bis 5e Java, ab 6e Python) */ - -package verteiltesysteme.socket.simple; - -import java.net.*; - -class UDPServer { - public static void main(String args[]) throws Exception { - int udpPort = 36037; - @SuppressWarnings("resource") - DatagramSocket serverSocket = new DatagramSocket(udpPort); - byte[] receiveData = new byte[1024]; - byte[] sendData = new byte[1024]; - - while (true) { - DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); - serverSocket.receive(receivePacket); - String sentence = new String(receivePacket.getData(), 0, receivePacket.getLength()); - - InetAddress IPAddress = receivePacket.getAddress(); - int clientSrcPort = receivePacket.getPort(); - - String capitalizedSentence = sentence.toUpperCase(); - sendData = capitalizedSentence.getBytes(); - DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, clientSrcPort); - serverSocket.send(sendPacket); - } - } -} +/* Angelehnt an Kurose/Ross Computernetzwerke (bis 5e Java, ab 6e Python) */ + +package verteiltesysteme.socket.simple; + +import java.net.*; + +class UDPServer { + public static void main(String args[]) throws Exception { + int udpPort = 36037; + @SuppressWarnings("resource") + DatagramSocket serverSocket = new DatagramSocket(udpPort); + byte[] receiveData = new byte[1024]; + byte[] sendData = new byte[1024]; + + while (true) { + DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); + serverSocket.receive(receivePacket); + String sentence = new String(receivePacket.getData(), 0, receivePacket.getLength()); + + InetAddress IPAddress = receivePacket.getAddress(); + int clientSrcPort = receivePacket.getPort(); + + + String capitalizedSentence = sentence.toUpperCase(); + sendData = capitalizedSentence.getBytes(); + DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, clientSrcPort); + serverSocket.send(sendPacket); + } + } +} diff --git a/VerteilteSysteme-Examples/src/verteiltesysteme/socket/timecounter/UDPTimeCounterClient.java b/VerteilteSysteme-Examples/src/verteiltesysteme/socket/timecounter/UDPTimeCounterClient.java index 80ccc73..fa93847 100644 --- a/VerteilteSysteme-Examples/src/verteiltesysteme/socket/timecounter/UDPTimeCounterClient.java +++ b/VerteilteSysteme-Examples/src/verteiltesysteme/socket/timecounter/UDPTimeCounterClient.java @@ -68,7 +68,7 @@ class UDPTimeCounterClient { // Delay als Zeit zwischen timestampSent und timestampEnd berechnen und // ausgeben delay = timestampEnd - timestampStart; - System.out.println("Delay = " + delay + " ms"); + System.out.println("Übertragungsdauer = " + delay + " ms"); System.out.println(System.lineSeparator()); // Antwort vom Server auswerten und ausgeben