@Override
    public void run() {
        try {
            while (running) {
                DatagramPacket packet = new DatagramPacket(new byte[256], 256);
                socket.receive(packet);
                InetAddress address = packet.getAddress();
                int port = packet.getPort();
                byte[] data = packet.getData();
                String infoString = new String(data);
                if(infoString.startsWith(initCode)) {
                    // return Ready
                    String dataStr = gameName;
                    data = dataStr.getBytes();
                    packet = new DatagramPacket(data, data.length, address, port);
                    socket.send(packet);
                    System.out.println(address + " asked for available games");
                }
                else {
               
                    lobbyPtr.HandleUDPResponse(address, infoString);
                    System.out.println(infoString + " found");
                }
            }
            socket.close();
        } catch (Exception e) {
            System.err.println("Error: " + e.getMessage());
        }
    }