GLBasic User Manual

Main sections

SOCK_UDPSEND

rv% = SOCK_UDPSEND(sockudp%, msg$, dest_ip_binary$, dest_port%)


Sends a message via UDP using a socket previously created with SOCK_UDPOPEN().
msg$ is the message text to send. The length of the message sent is the exact length of the text provided. No terminating '\0' will be appended for example as a TCP application would usually do.
dest_ip_binary$ is the IP address of the recipient. You can get this information from SOCK_GETHOSTIP$().
dest_port% is the port from which the recipient reads.

The return value rv% indicates the number of bytes sent. If the value is -1, there was an error.
You can retrieve any error messages with NETGETLASTERROR$().

See also...