Datagram Packet Slice

April 02, 2020

About

Auto slice and merge datagram packet, no need care about packet size.


Download

Add maven repository url https://dl.bintray.com/pacey6/maven.

Download the latest JAR at the coordinates com.pacey6.net:datagram:1.0.


Source Code

See Github.


Usage

MulticastSocket multicastSocket = new MulticastSocket(1027);
MultiDatagramSocket<MulticastSocket> multiDatagramSocket = new MultiDatagramSocket<>(multicastSocket);
MultiDatagramPacket multiDatagramPacket = multiDatagramSocket.receive();
String msg = new String(multiDatagramPacket.getData());
String msg = "Hello world";
MultiDatagramPacket multiDatagramPacket = new MultiDatagramPacket(msg.getBytes(), InetAddress.getLocalHost(), 1027);
multiDatagramSocket.send(multiDatagramPacket);
Pacey Lau
Developer