Module: fathom/socket/multicast

This component provides functions for sending and receiving multicast messages using UDP over IPv4.
Source:

Methods

(static) close(callback)

This function closes a multicast socket.
Parameters:
Name Type Description
callback function The callback Fathom invokes once the operation completes. On error, its only argument is a dictionary whose member "error" describes the problem that occurred.
Source:

(static) join(callback, ip)

Join the given multicast group
Parameters:
Name Type Description
callback function The callback Fathom invokes once the operation completes. If successful, its only argument is a numerical socket ID. On error, its only argument is a dictionary whose member "error" describes the problem that occurred.
ip string The IPv4 address of the multicast group to join.
Source:

(static) open(callback, ttl, loopback)

This function opens a multicast socket.
Parameters:
Name Type Description
callback function The callback Fathom invokes once the operation completes. On error, its only argument is a dictionary whose member "error" describes the problem that occurred.
ttl integer The multicast TTL, i.e., the number of hops the datagram can traverse, doubling as the multicast "threshold" of host/network/site/etc.
loopback boolean If True, this host will receive its own messages.
Source:

(static) recv(callback, socketid, asstring, timeout, size)

This function receives data on a UDP socket.
Parameters:
Name Type Description
callback function The callback Fathom invokes once the operation completes. If successful, the function receives a dictionary with two members: "data" for the data actually read, and "length" for the full length of the data chunk received. On error, its only argument is a dictionary whose member "error" describes the problem that occurred.
socketid integer The socket handle previously obtained for this UDP flow.
asstring boolean Return the bytes as string (default false).
timeout integer Time to wait for the data (in ms), < 0 waits forever, 0 no wait (default).
size integer Number of bytes to read (or 0 to ignore - default).
Source:

(static) recvfrom(callback, socketid, asstring, timeout, size)

This function receives data on a UDP socket, from a specific sender.
Parameters:
Name Type Description
callback function The callback Fathom invokes once the operation completes. If successful, the function receives a dictionary with two members: "data" for the data actually read, and "length" for the full length of the data chunk received. On error, its only argument is a dictionary whose member "error" describes the problem that occurred.
socketid integer The socket handle previously obtained for this UDP flow.
asstring boolean Return the bytes as string (default false).
timeout integer Time to wait for the data (in ms), < 0 waits forever, 0 no wait (default).
size integer Number of bytes to read (or 0 to ignore - default).
Source:

(static) recvfromstart(callback, socketid, asstring, size)

This function establishes a callback to get invoked automatically whenever data arrive on a given UDP socket, from a specific sender. To stop receiving, call recvfromstop().
Parameters:
Name Type Description
callback function The callback Fathom invokes once the operation completes. If successful, the function receives a dictionary with two members: "data" for the data actually read, and "length" for the full length of the data chunk received. On error, its only argument is a dictionary whose member "error" describes the problem that occurred.
socketid integer The socket handle previously obtained for this UDP flow.
asstring boolean Return the bytes as string (default false).
size integer Number of bytes to read (or 0 to ignore - default).
Source:

(static) recvfromstop(callback, socketid)

This function cancels the callbacks previously installed via recvfromstart().
Parameters:
Name Type Description
callback function The callback Fathom invokes once the operation completes. On error, its only argument is a dictionary whose member "error" describes the problem that occurred.
socketid integer The socket handle previously obtained for this UDP flow.
Source:

(static) recvstart(callback, socketid, asstring, size)

This function establishes a callback to get invoked automatically whenever data arrive on a given UDP socket. To stop receiving, call recvstop().
Parameters:
Name Type Description
callback function The callback Fathom invokes once the operation completes. If successful, the function receives a dictionary with two members: "data" for the data actually read, and "length" for the full length of the data chunk received. On error, its only argument is a dictionary whose member "error" describes the problem that occurred.
socketid integer The socket handle previously obtained for this UDP flow.
asstring boolean Return the bytes as string (default false).
size integer Number of bytes to read (or 0 to ignore - default).
Source:

(static) recvstop(callback, socketid)

This function cancels the callbacks previously installed via recvstart().
Parameters:
Name Type Description
callback function The callback Fathom invokes once the operation completes. On error, its only argument is a dictionary whose member "error" describes the problem that occurred.
socketid integer The socket handle previously obtained for this UDP flow.
Source:

(static) send(callback, socketid, data)

This function sends data over a UDP socket.
Parameters:
Name Type Description
callback function The callback Fathom invokes once the operation completes. On error, its only argument is a dictionary whose member "error" describes the problem that occurred.
socketid integer The socket handle previously obtained for this UDP flow.
data string Data to send.
Source:

(static) sendrecv(callback, socketid, data, asstring, timeout, size)

This function sends data on a UDP socket and reads subsequently returned responses. This function is an optimization, saving one message-passing roundtrip into the Fathom core to read the response after having sent data.
Parameters:
Name Type Description
callback function The callback Fathom invokes once the operation completes. If successful, the function receives a dictionary with two members: "data" for the data actually read, and "length" for the full length of the data chunk received. On error, its only argument is a dictionary whose member "error" describes the problem that occurred.
socketid integer The socket handle previously obtained for this UDP flow.
data string Data to send.
asstring boolean Return the bytes as string (default false).
timeout integer Time to wait for the data (in ms), < 0 waits forever, 0 no wait (default).
size integer Number of bytes to read (or 0 to ignore - default).
Source:

(static) sendto(callback, socketid, data, ip, port)

This function sends data over a UDP socket, to a specific destination.
Parameters:
Name Type Description
callback function The callback Fathom invokes once the operation completes. On error, its only argument is a dictionary whose member "error" describes the problem that occurred.
socketid integer The socket handle previously obtained for this UDP flow.
data string Data to send.
ip string IP address to send to.
port integer Port to send to.
Source: