|
This Java tip demonstrates a method of sending a Datagram. This code may be
used in implementing a communication between different components in a network.
public static void senddatagram(InetAddress target,
int port, byte[] outbuf, int len) {
try {
DatagramPacket request = new DatagramPacket(outbuf,
len, target, port);
DatagramSocket socket = new DatagramSocket();
socket.send(request);
} catch (SocketException e) {
} catch (IOException e) {
}
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.