Вопрос

I'm revising for a network exam and this is one of the questions in a few past papers.

Name 3 classes in Java which implement system independent datagram communication?

I was led to believe there were only 2 class to implement system independent datagram communication;

  • DatagramPacket
  • DatagramSocket

What could the 3rd class be?

Answers greatly appreciated

Это было полезно?

Решение

The java.net package contains three classes to help you write Java programs that use datagrams to send and receive packets over the network:

DatagramSocket, DatagramPacket, and MulticastSocket

public class MulticastSocket extends DatagramSocket

An application can send and receive DatagramPackets through a DatagramSocket. In addition, DatagramPackets can be broadcast to multiple recipients all listening to a MulticastSocket.

The multicast datagram socket class is useful for sending and receiving IP multicast packets. A MulticastSocket is a (UDP) DatagramSocket, with additional capabilities for joining "groups" of other multicast hosts on the internet.

A multicast group is specified by a class D IP address and by a standard UDP port number. Class D IP addresses are in the range 224.0.0.0 to 239.255.255.255, inclusive. The address 224.0.0.0 is reserved and should not be used.

Другие советы

According to the Java Trails, it looks like you're missing the MulticastSocket, which would allow you to listen to requests coming in from multicast addresses.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top