Name
DatagramConnection
Synopsis
DatagramConnection is a Connection that
is used to send Datagram objects to one or more receivers.
A datagram is a sequence of bytes that is delivered together in the form of
a message. Datagrams are not guaranteed to be delivered. In addition, the
order of delivery of successive datagrams does not always match the order
in which they were sent. Since a DatagramConnection deals in discrete messages, it does not have any associated input or output streams.
A DatagramConnection receiver is obtained by calling the
Connector
open() method with a
name argument of the form
datagram://:port, where port is the
port number to which senders should address messages.
DatagramConnections created in this way can also be used
to send Datagrams, often as responses. A
DatagramConnection created in this way is said to
be in server mode.
A DatagramConnection sender is obtained by supplying a
name argument of the form
datagram://host:port. This type of
DatagramConnection is said to be in
client mode. The difference between server and client modes is that the port number for server mode is known in advance (and must be known by senders so that they can address messages). In client mode, the port number is dynamically allocated, and it may be different each time the client executes. The client port number will appear in the messages received by the server and can be used to address the reply message. There is currently no direct way for a client to find out the port ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access