title: Java Listening to a UDP port
body: <p>I want to listen to a UDP port to receive the information it is transferring in wireshark it looks like this <img src="https://i.stack.imgur.com/3MHTm.png" alt="Wireshark Filtered Image"></p>
  
  <p>all that I found was people creating ServerSockets but when i try that I dont get any output from the console.</p>
  
  <pre><code>package me.xenopyax.albionmarket;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.net.DatagramPacket;
  import java.net.DatagramSocket;
  import java.net.InetAddress;
  import java.net.ServerSocket;
  import java.net.Socket;
  
  public class Main {
  
      public static void main(String[] args) throws IOException {
  
          DatagramSocket serverSocket = new DatagramSocket(5056);
          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());
            System.out.println("RECEIVED: " + sentence);
            InetAddress IPAddress = receivePacket.getAddress();
            int port = receivePacket.getPort();
            String capitalizedSentence = sentence.toUpperCase();
            sendData = capitalizedSentence.getBytes();
            DatagramPacket sendPacket =
            new DatagramPacket(sendData, sendData.length, IPAddress, port);
            serverSocket.send(sendPacket);
         }
  
      }
  
  }
  </code></pre>
  
  <p>Am I corret with using ServersSockets to listen to the port. or what am I doing wrong?</p>