ost::TCPSession - The TCP session is used to primarily to represent a client connection that can be
Contents
Constructor & Destructor Documentation
ost::TCPSession::TCPSession(constIPV4Host&host,tpport_tport,size_tsize=536,intpri=0,size_tstack=0)
Create a TCP socket that will be connected to a remote TCP server and that will execute under it's own
thread.
Parametershost internet address of remote TCP server.
port number of remote server.
size of streaming buffer.
pri execution priority relative to parent.
stack allocation needed on some platforms.
ost::TCPSession::TCPSession(constIPV6Host&host,tpport_tport,size_tsize=536,intpri=0,size_tstack=0)ost::TCPSession::TCPSession(TCPSocket&server,intpri=0,size_tstack=0)
Create a TCP socket from a bound TCP server by accepting a pending connection from that server and
execute a thread for the accepted connection.
Parametersserver tcp socket to accept a connection from.
pri execution priority relative to parent.
stack allocation needed on some platforms.
ost::TCPSession::TCPSession(TCPV6Socket&server,intpri=0,size_tstack=0)virtualost::TCPSession::~TCPSession()[virtual]
Make sure destruction happens through a virtual...
Detailed Description
The TCP session is used to primarily to represent a client connection that can be managed on a separate
thread.
The TCP session also supports a non-blocking connection scheme which prevents blocking during the
constructor and moving the process of completing a connection into the thread that executes for the
session.
Author
David Sugar dyfet@ostel.com
Threaded streamable socket with non-blocking constructor.
Examplestcpthread.cpp.
Member Function Documentation
voidost::TCPSession::initial(void)[protected],[virtual]
The initial method is used to esablish a connection when delayed completion is used. This assures the
constructor terminates without having to wait for a connection request to complete.
Reimplemented from ost::Thread.
intost::TCPSession::waitConnection(timeout_ttimeout=TIMEOUT_INF)[protected]
Normally called during the thread Initial() method by default, this will wait for the socket connection
to complete when connecting to a remote socket. One might wish to use setCompletion() to change the
socket back to blocking I/O calls after the connection completes. To implement the session one must
create a derived class which implements run().
Returns
0 if successful, -1 if timed out.
Parameterstimeout to wait for completion in milliseconds.
Name
ost::TCPSession - The TCP session is used to primarily to represent a client connection that can be
managed on a separate thread.
Synopsis
#include <socket.h>
Inherits ost::Thread, and ost::TCPStream.
PublicMemberFunctionsTCPSession (const IPV4Host &host, tpport_t port, size_t size=536, int pri=0, size_t stack=0)
Create a TCP socket that will be connected to a remote TCP server and that will execute under it's
own thread.
TCPSession (const IPV6Host &host, tpport_t port, size_t size=536, int pri=0, size_t stack=0)
TCPSession (TCPSocket &server, int pri=0, size_t stack=0)
Create a TCP socket from a bound TCP server by accepting a pending connection from that server and
execute a thread for the accepted connection.
TCPSession (TCPV6Socket &server, int pri=0, size_t stack=0)
virtual ~TCPSession ()
Make sure destruction happens through a virtual...
ProtectedMemberFunctions
int waitConnection (timeout_ttimeout=TIMEOUT_INF)
Normally called during the thread Initial() method by default, this will wait for the socket
connection to complete when connecting to a remote socket.
void initial (void)
The initial method is used to esablish a connection when delayed completion is used.
AdditionalInheritedMembers