component fathom.socket.tcp
This component provides APIs for communication over
TCP.
Methods
Methods | Returns | Description |
---|---|---|
closeSocket(
callback
)
|
void
static
|
↑
This function closes a TCP socket.
Parameters:
|
getHostIP(
callback, socketid
)
|
void
static
|
↑
This function returns the IP address of the
local endpoint of a given TCP connection.
Parameters:
|
getPeerIP(
callback, socketid
)
|
void
static
|
↑
This function returns the IP address of the
remote endpoint of a given TCP connection.
Parameters:
|
openReceiveSocket(
callback, port
)
|
void
static
|
↑
This function creates a TCP socket, binds it
locally to the given port, and listens for connections.
(1) Rename to openListenSocket or some such, to avoid the impression that this socket is useful for receiving only. (2) What interface does this bind to on a multihomed host? (3) How does one accept() connections?
Parameters:
|
openSendSocket(
callback, destip, destport
)
|
void
static
|
↑
This function creates a TCP socket and connects
it to the given destination.
Rename to openConnectSocket or some such, to avoid the impression that this socket is useful for sending only.
Parameters:
|
receive(
callback, socketid
)
|
void
static
|
↑
This function receives data on a TCP connection.
Parameters:
|
send(
callback, socketid, data
)
|
void
static
|
↑
This function sends data over the TCP connection
identified by the given socket ID.
This function should report back the number of bytes sent successfully, and also needs error semantics.
Parameters:
|