Home » Core Java » net » DatagramPacket

DatagramPacket

Send network DatagramPacket

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

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 »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns