Functions

Recv(port) Constructor
Recv:ip() Get IP address
Recv:port() Get port
Recv:recv() Poll messages (retrieve from the network socket queue)

Functions

Recv(port)

Constructor

Parameters:

port optional port number (defaults to 4110)

Return:

  • The Recv object
Recv:ip()

Get IP address

Return:

  • address as a string
Recv:port()

Get port

Return:

  • port as a number
Recv:recv()

Returns an iterator; each iteration returns a message as a table (m), with message arguments in the array portion, and message types and address in the m.types and m.addr fields. Example:

  for m in r:recv() do
     print(m.addr, m.types, unpack(m))
  end
 

Example of how to poll:

  go(function()
     while(true) do
        for m in r:recv() do
           print(m.addr, m.types, unpack(m))
        end
        
        wait(/1/30)   -- polling interval
     end
  end)
 

Return:

  • iterator