UDP Plugin Overview

The UDP plugin enables the use of simple socket connections with SWF Studio applications. Using the UDP plugin, you can send and receive messages using UDP datagrams, as well as broadcast messages to computers on a local subnet.

The UDP plugin uses connectionless sockets, making them very efficient for quick communication between computers. You can use this plugin in situations where it is not necessary to know if the transmitted message was received by the destination computer(s). It must also be noted that there is no guarantee as to the order in which messages will arrive. Though it is very unlikely, it is possible for two messages sent at almost the same time to arrive in the reverse order from which they were sent.

In order to send or receive messages, follow these steps:

 Open a socket on a port of your choice using UDP.open. It is important to note that some ports have special significance, and should not be picked purely randomly. In most cases, it is safest to choose a port number between 49152 and 65535. For more information, refer to this IANA web page.

 To receive messages, you must register to receive notifications regarding incoming messages, as well start the message reception mechanism. See UDP.setNotify and UDP.recvMsg.

 To send a message to a single machine, use UDP.sendMsg or UDP.sendMsgBinary. To broadcast to all computers on your local subnet, use UDP.broadcastMsg or UDP.broadcastMsgBinary.

 When finished, call UDP.close to clean up. This will also terminate the previous call to UDP.recvMsg.

Because the UDP protocol does not guarantee delivery, it is advisable to keep messages fairly short. Messages that are too big will be rejected (by the network or the receiving computer) without feedback.