@Override
    public void run() {

        try {

            byte[] buf = new byte[1000];
            DatagramPacket dgp = new DatagramPacket(buf, buf.length);
            DatagramSocket sk;

            sk = new DatagramSocket(PORT);
            sk.setSoTimeout(5000);

            while (listening) {

                try {
                    sk.receive(dgp);
                    String rcvd = new String(dgp.getData(), 0, dgp.getLength()) + ", from address: "
                            + dgp.getAddress() + ", port: " + dgp.getPort();
                    System.out.println("SBR" + rcvd);

                    buf = NetworkManager.makeConnectionString().getBytes();
                    DatagramPacket out = new DatagramPacket(buf, buf.length, dgp.getAddress(), dgp.getPort());
                    sk.send(out);
                } catch (SocketTimeoutException ste) {
                }
            }

        } catch (SocketException ex) {
            Logger.getLogger(BroadcastDiscoveryListener.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(BroadcastDiscoveryListener.class.getName()).log(Level.SEVERE, null, ex);
        }

    }