Code example for DatagramPacket

Methods: setAddresssetPort

0
	 
	public synchronized void Detect() 
	{ 
		if (dSocket == null) return;
		try { 
			DatagramPacket sPacket = new DatagramPacket(Key, Key.length);
			sPacket.setPort(Port);
			sPacket.setAddress(InetAddress.getByAddress(new byte[] { (byte)255, (byte)255, (byte)255, (byte)255 }));
			dSocket.send(sPacket);
		} catch (UnknownHostException e) { } catch (IOException e) { }
	} 
} 
Contextual code suggestions in your IDE  Get Codota for Java