UDP OPEN statement

Purpose | Create a socket for an application to communicate with a UDP server or client using the UDP (connectionless) protocol over Winsock (UDP/IP).
Syntax | UDP OPEN [PORT p&] AS [#] fNum& [TIMEOUT timeoutval&]
Remarks | Open a UDP socket (port or service) for UDP communication. FNum& is a file number such as #1, or a variable with a value obtained using the FREEFILE function.
PORT | If PORT p& is specified, the socket is opened as a server that can receive UDP data. Use the UDP NOTIFY statement to receive server notifications from the socket so that the data can be retrieved. Common port numbers include 7 (Echo, see RFC 862); 37 (Time, see RFC868); and 123 (NTP - RFC1305).
TIMEOUT | The TIMEOUT option allows you to specify how long, in milliseconds (mSec), a UDP SEND/RECV operation should wait for completion. If the specified number of milliseconds elapses, the UDP operation will fail, and the ERR system variable will be set to indicate a run-time Error 24 ("Device timeout"). The default timeout is 60000 milliseconds (60 seconds).
See also | TCP and UDP Communication, FREEFILE, TCP OPEN, UDP CLOSE, UDP NOTIFY, UDP RECV, UDP SEND