Home » datagrampacket

Tag Archives: datagrampacket

java.net.MulticastSocket Example

Bipartite Graph

In this example we are going to explain how to use MulticastSocket in Java, in order to enable a server to easily send information to multiple clients, which are all connected to the same port and address. We will describe the whole process, by creating both the server and the client, and guide you through the main concepts that need to be understood to ...

Read More »

Send network DatagramPacket

Bipartite Graph

This is an example of how to send a Datagram packet over the network in Java. Sending Datagram packets between two hosts in Java implies that you should : Retrieve the Address object of the target host. This object contains all address related information about the specific host Create a DatagramPacket Object providing the actual data to be send, the ...

Read More »

Receive network DatagramPacket

Bipartite Graph

In this example we shall show you how to receive a Datagram packet in Java. For a host to receive Datagram packets in Java implies that you should : Create a DatagramPacket Object providing a placeholder for the received data – here an empty byte array of the default 256 bytes size Create a DatagramSocket Object to receive the Datagram ...

Read More »