Name
SendUDPData -- send data through UDP protocol (V5.0)
Synopsis
count = SendUDPData(id, data$[, ip$, port])
Function
This function will send the data specified in data$ to the recipient specified by ip$ and port. The data will be sent through the UDP object specified in the first argument. This UDP object must have been created by CreateUDPObject() before. For performance reasons, you must pass an IP address directly to this function. Passing a host name instead is not supported because it would have to be resolved first which would take too much time. SendUDPData() will return the number of bytes successfully transferred. This can be less than the number of bytes in data$.

Please note that although the data argument is a string, it is not limited to text only. You can also send binary data with this function because Hollywood strings can handle character control codes as well as the special NULL character without problems.

Starting with Hollywood 8.0, the ip$ and port arguments are not required in case the UDP object has been created as a UDP object of type #UDPCLIENT. In that case, the UDP object is already connected and you don't have to pass ip$ and port. In fact, they are ignored for UDP objects of type #UDPCLIENT. See CreateUDPObject for details.

Note that the global network timeout set using SetNetworkTimeout() is currently ignored by SendUDPData().

Inputs
id
identifier of the UDP object to use
data$
string containing the data that should be sent
ip$
optional: IP address of recipient; must be specified for UDP objects of type #UDPSERVER and #UDPNONE
port
optional: port number of recipient; must be specified for UDP objects of type #UDPSERVER and #UDPNONE
Results
count
number of bytes successfully transmitted

Show TOC