@Override
	public void executeTask() {
		try {
			sendingSocket = new DatagramSocket(SENDING_PORT);
			sendingSocket.setBroadcast(true);

			client = new Client();
			client.setCurrentIP(InetAddress.getLocalHost().getHostAddress());
			client.setHostname(InetAddress.getLocalHost().getHostName());
			client.setReceivingPort(ServerReceiverServlet.LISTENING_PORT);
			client.setUsername("Client " + client.getHostname());

			client.SERVER_COMMAND = COMMAND_TYPE.REGISTER_NODE;

			buffer = client.toBytes();

			String defGateway = DCServer.GetDefaultGateway();

			String ipPiece = defGateway.substring(0, defGateway.length() - 1);

			String[] ipPieces = defGateway.split("\\.");

			ipPiece = ipPieces[0] + "." + ipPieces[1] + ".";

			for (int i = 0; i < 255; i++) {
				for (int j = 0; j < 255; j++) {
					String builtIP = ipPiece + Integer.toString(i) + "."
							+ Integer.toString(j);

					dataGram = new DatagramPacket(buffer, buffer.length);
					dataGram.setPort(ServerReceiverServlet.LISTENING_PORT);
					dataGram.setAddress(InetAddress.getByName(builtIP));

					sendingSocket.send(dataGram);
				}
			}

			sendingSocket.close();
		} catch (SocketException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		// String userInput =
		// SynchedInOut.getInstance().postMessageForUserInput("Network scan finished. Scan again? (y/n): ");
		//
		// if(userInput.equalsIgnoreCase("y")) {
		// executeTask();
		// }

		stopTask();
	}