namespace UDP

The UDP namespace provides a set of tools to access udp streams

namespace contents
Classes
class Stream - Used for sending and receiving UDP datagrams
Functions
function bind(string,number,number) - Binds the socket to the specified IP and port
function connect(string,number,number) - Sets the default destination of the socket

Functions

function bind Click to go up to the list
Binds the socket to the specified IP and port
Declaration:
    function bind(string host, number port)
Description:
This function binds the socket to a specific IP and port (although the IP can be Network.ANY which means "listen to every IP address on the machine"). You do not need to listen() or accept() like TCP sockets. If the address family is Network.AF_IPV4, bind will look for an IPV4 address with that name and fail if it doesn't find one. If it is Network.AF_IPV6, it will look for an IPV6 address and fail if it doesn't find one. If it is Network.AF_AUTO, it will try to find an IPV6 address, then try to find an IPV4 address, and only fail if it doesn't find either. Note: you can leave off the af parameter if you wish, and it will default to Network.AF_AUTO.
Parameters:
    Parameter #1: string host - The hostname or IP to listen on, or Network.ANY
    Parameter #2: number port - The port number to listen on
    Parameter #3: number af - The address family to use

function connect Click to go up to the list
Sets the default destination of the socket
Declaration:
    function connect(string host, number port)
Description:
This function creates a usp stream and sets the default destination of the UDP socket. Note that it does not actually connect to the remote server or indeed even communicate with it in any way. If the address family is Network.AF_IPV4, connect will look for an IPV4 address with that name and fail if it doesn't find one. If it is Network.AF_IPV6, it will look for an IPV6 address and fail if it doesn't find one. If it is Network.AF_AUTO, it will try to find an IPV6 address, then try to find an IPV4 address, and only fail if it doesn't find either. Note: you can leave off the af parameter if you wish, and it will default to Network.AF_AUTO.
Parameters:
    Parameter #1: string host - The hostname or IP of the destination
    Parameter #2: number port - The destination port number
    Parameter #3: number af - The address family to use (Network.AF_IPV4 or Network.AF_IPV6)

Automatically generated at 12:07PM, Wednesday 25 May 2005 by feritedoc.