|
|
TCP sockets are used for stream based connected sessions between two sockets. Both error recovery and flow control operate transparently for a TCP socket connection. The TCP socket base class is primary used to bind a TCP "server" for accepting TCP streams.
bool OnAccept (InetHostAddress &ia, short port) |
A method to call in a derived TCPSocket class that is acting as a server when a connection request is being accepted. The server can implement protocol specific rules to exclude the remote socket from being accepted by returning false. The Peek method can also be used for this purpose.
Parameters:
ia | internet host address of the client. |
port | number of the client. |
Returns: true if client should be accepted.
TCPSocket (InetAddress &bind, short port, int backlog = 5) |
A TCP "server" is created as a TCP socket that is bound to a hardware address and port number on the local machine and that has a backlog queue to listen for remote connection requests. If the server cannot be created, an exception is thrown.
Parameters:
bind | local ip address or interface to use. |
port | number to bind socket under. |
backlog | size of connection request queue. |
inline InetHostAddress getRequest (short *port = NULL) |
Return address and port of next connection request. This can be used instead of OnAccept() to pre-evaluate connection requests.
Parameters:
port | number of requestor. |
Returns: host requesting a connection.
void Reject (void) |
Used to reject the next incoming connection request.
inline bool isPending (timeout_t timeout = ~0) |
Used to wait for pending connection requests.
Reimplemented from Socket
~TCPSocket () |
Use base socket handler for ending this socket.