This accessor listens for UDP (datagram) messages on the specified
host interface and port. If the value of the port
input is
initially negative, then this accessor waits until it receives a
non-negative port
input before initiating listening. Otherwise,
it begins listening during initialization. If at any time during
execution it receives a port
input, then it will close any open
socket and, if the new port
value is non-negative, open a new
socket to the current host
and port
.
When the connection is established, a true
boolean is sent to
the listening
output. If the connection is broken during
execution, then a false
boolean is sent to the listening
output. The swarmlet could respond to this by retrying to connect
(send an event to the port
input).
The receive type can be any of those supported by the host. The
list of supported types will be provided as options for the and
receiveType
parameter. For the Ptolemy II host, these include at
least 'string', 'number', 'image', and a variety of numeric types.
Note that UDP, unlike TCP, has the notion of a "message" (a
datagram). A message can contain more than one byte. The
receiveType
determines the type of the elements of the output of
this accessor.
- Version:
- $$Id$$
- Source:
Inputs:
Name | Type | Description |
---|---|---|
listeningAddress |
string | The interface to listen on for incoming messages. This defaults to "0.0.0.0", which means to listen on all network interfaces. |
listeningPort |
int | The port to listen on for incoming messages. This defaults to 8084. |
Outputs:
Name | Type | Description |
---|---|---|
message |
The received message as a raw byte array. | |
listening |
boolean | True to indicate that listening has begun, false to indicate that it has stopped. |
Parameters:
Name | Type | Description |
---|---|---|
receiveType |
string | See above. |