|
|
@ -12,6 +12,8 @@ class UDPServer { |
|
|
|
byte[] receiveData = new byte[1024]; |
|
|
|
byte[] sendData = new byte[1024]; |
|
|
|
|
|
|
|
System.out.println("UDP Server started. Waiting for incoming requests..."); |
|
|
|
|
|
|
|
while (true) { |
|
|
|
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); |
|
|
|
serverSocket.receive(receivePacket); |
|
|
@ -20,6 +22,7 @@ class UDPServer { |
|
|
|
InetAddress IPAddress = receivePacket.getAddress(); |
|
|
|
int clientSrcPort = receivePacket.getPort(); |
|
|
|
|
|
|
|
System.out.println("Received request from client " + IPAddress + ":" + clientSrcPort + " generating response..."); |
|
|
|
|
|
|
|
String capitalizedSentence = sentence.toUpperCase(); |
|
|
|
sendData = capitalizedSentence.getBytes(); |
|
|
|