component fathom.socket.udp
This component provides APIs for unicast
communication over UDP. For multicast and broadcast options,
see the respective namespaces.
Methods
Methods | Returns | Description |
---|---|---|
bind(
callback, socketid, addr, port
)
|
void
static
|
↑
This function binds a UDP socket to a local IP
address and port.
Parameters:
|
close(
callback
)
|
void
static
|
↑
This function closes a UDP socket.
Parameters:
|
getHostIP(
callback, socketid
)
|
void
static
|
↑
This function returns the IP address of the
local endpoint of a given UDP flow.
Parameters:
|
getPeerIP(
callback, socketid
)
|
void
static
|
↑
This function returns the IP address of the
remote endpoint of a given UDP flow.
Parameters:
|
open(
callback
)
|
void
static
|
↑
This function creates a UDP socket.
Parameters:
|
recv(
callback, socketid, length
)
|
void
static
|
↑
This function receives data on a UDP socket.
Parameters:
|
recvfromstart(
callback, socketid
)
|
void
static
|
↑
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().
This function is not complete. It still needs the IP address and port we want to receive from.
Parameters:
|
recvfromstop(
callback, socketid
)
|
void
static
|
↑
This function cancels the callbacks previously
installed via recvfromstart().
Parameters:
|
recvstart(
callback, socketid, length
)
|
void
static
|
↑
This function establishes a callback to get
invoked automatically whenever data arrive on a given UDP
socket. To stop receiving, call recvstop().
Parameters:
|
recvstop(
callback, socketid
)
|
void
static
|
↑
This function cancels the callbacks previously
installed via recvstart().
Parameters:
|
send(
callback, socketid, data
)
|
void
static
|
↑
This function sends data over a UDP socket.
This function should report back the number of bytes sent successfully, and also needs error semantics.
Parameters:
|
sendrecv(
callback, socketid, data, length
)
|
void
static
|
↑
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:
|
sendto(
callback, socketid, data, ip, port
)
|
void
static
|
↑
This function sends data over a UDP socket, to a
specific destination.
This function should report back the number of bytes sent successfully, and also needs error semantics.
Parameters:
|
setsockopt(
callback, socketid, name, value
)
|
void
static
|
↑
This function sets options on a given UDP socket.
Parameters:
|