UdpServer
Generic typessource
Requires unsafe mode.
Constructors
function UdpServer.new(host: string, port: integer): UdpServerhost:stringport:integer
Returns UdpServer
function UdpServer.new(address: string): UdpServeraddress:string
Returns UdpServer
function UdpServer.new(): UdpServerReturns UdpServer
Methods
read
function UdpServer:read(fun: function): integerfun:function- Callback signature not known from the code.
Returns integer
Read message from the socket buffer. Reads maximum of 32KiB at the time. If the message is longer, it will be split to portions of 32KiB. On failure or empty buffer returns -1, on success calls the function with signature nil(message, source)
send
function UdpServer:send(message: string, address: string): integermessage:stringaddress:string
Returns integer
function UdpServer:send(message: string, host: string, port: integer): integermessage:stringhost:stringport:integer
Returns integer