class TCPSocket

bound server for TCP streams and sessions. More...

Definition#include <socket.h>
InheritsSocket [private]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Members

Protected Members


Detailed Description

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 (const InetHostAddress &ia, short port)
[protected virtual]

DO NOT OVERWRITE THIS method anymore. THIS WILL NOT WORK! use bool OnAccept(const InetHostAddress &ia, tpport_t port) instead.

bool OnAccept (const InetHostAddress &ia, tpport_t port)
[protected virtual]

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:
iainternet host address of the client.
portnumber of the client.

Returns: true if client should be accepted.

TCPSocket (const InetAddress &bind, tpport_t 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:
bindlocal ip address or interface to use.
portnumber to bind socket under.
backlogsize of connection request queue.

inline InetHostAddress getRequest (tpport_t *port = NULL)
[const]

Return address and port of next connection request. This can be used instead of OnAccept() to pre-evaluate connection requests.

Parameters:
portnumber of requestor.

Returns: host requesting a connection.

void Reject (void)

Used to reject the next incoming connection request.

inline InetHostAddress getLocal (tpport_t *port = NULL)
[const]

Used to get local bound address.

Reimplemented from Socket

inline bool isPending (timeout_t timeout = TIMEOUT_INF)

Used to wait for pending connection requests.

Reimplemented from Socket

~TCPSocket ()

Use base socket handler for ending this socket.