Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

UnixSession Class Reference

The Unix domain session is used to primarily to represent a client connection that can be managed on a seperate thread. Threaded streamable unix domain socket with non-blocking constructor. More...

#include <unix.h>

Inheritance diagram for UnixSession:

UnixStream Thread Socket List of all members.

Public Member Functions

 UnixSession (const char *pathname, int size=512, int pri=0, int stack=0)
 Create a Unix domain socket that will be connected to a local server server and that will execute under it's own thread.
 UnixSession (UnixSocket &server, int size=512, int pri=0, int stack=0)
 Create a Unix domain socket from a bound Unix domain server by accepting a pending connection from that server and execute a thread for the accepted connection.

Protected Member Functions

int waitConnection (timeout_t timeout=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.
 CCXX_MEMBER (void) initial(void)
 The initial method is used to esablish a connection when delayed completion is used.
 CCXX_MEMBER (void) final(void)
 UnixSession derived objects can be freely created with "new" and safely terminate their "Run" method on their own by self-deleting when the thread terminates.

Detailed Description

The Unix domain session is used to primarily to represent a client connection that can be managed on a seperate thread. Threaded streamable unix domain socket with non-blocking constructor.

The Unix domain 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:
Alex Pavloff <alex@pavloff.net>


Constructor & Destructor Documentation

UnixSession::UnixSession const char *  pathname,
int  size = 512,
int  pri = 0,
int  stack = 0
 

Create a Unix domain socket that will be connected to a local server server and that will execute under it's own thread.

Parameters:
pathname path to socket
size of streaming buffer.
pri execution priority relative to parent.
stack allocation needed on some platforms.

UnixSession::UnixSession UnixSocket server,
int  size = 512,
int  pri = 0,
int  stack = 0
 

Create a Unix domain socket from a bound Unix domain server by accepting a pending connection from that server and execute a thread for the accepted connection.

Parameters:
server unix domain socket to accept a connection from.
size of streaming buffer.
pri execution priority relative to parent.
stack allocation needed on some platforms.


Member Function Documentation

UnixSession::CCXX_MEMBER void   )  [inline, protected]
 

UnixSession derived objects can be freely created with "new" and safely terminate their "Run" method on their own by self-deleting when the thread terminates.

UnixSession::CCXX_MEMBER void   )  [protected]
 

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.

int UnixSession::waitConnection timeout_t  timeout = 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.
Parameters:
timeout to wait for completion in milliseconds.


The documentation for this class was generated from the following file:
Generated on Tue Jan 18 14:32:39 2005 for GNU CommonC++ by  doxygen 1.3.9.1