@Override
    public void run() {
        DatagramSocket socket = null;
        try {
            Logger.getInstance().log("ADV-REC","start scanning");
            long endTime = new Date().getTime() + time;

            try {
                socket = new DatagramSocket(new InetSocketAddress("255.255.255.255", port));
                socket.setSoTimeout(4000);
            } catch (SocketException e) {
                Logger.getInstance().log("ADV-REC","ERR:" + e.getMessage());
                lastException = e;
                return;
            }
            while (new Date().getTime() <= endTime) {
                try {
                    byte[] buf = new byte[1000];
                    DatagramPacket packet = new DatagramPacket(buf,
                            buf.length);
                    socket.receive(packet);
                    int size = 0;
                    for(int i = 0; i != buf.length; ++i)
                        if(buf[i] == '\0')
                            break;
                        else
                            size++;
                    byte actualString[] = new byte[size];
                    for(int i = 0; i != size; ++i)
                        actualString[i] = buf[i];
                    String message = new String(actualString);
                    addZombieIfNotAlreadyFound(message);
                } catch (IOException e) {
                    Logger.getInstance().log("ADV-REC","ERR:" + e.getMessage());
                }
            }
        } finally {
            if(socket != null)
                socket.close();
        }
    }