Dv::Net::usocket Class Reference

Unix socket iostream specialization. More...

#include <usocket.h>

Inheritance diagram for Dv::Net::usocket:
Inheritance graph
[legend]
Collaboration diagram for Dv::Net::usocket:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 usocket (const std::string &servername, time_t millisecs=0, const std::string &filename="", unsigned int min_debug_level=0, Debugable *debug_master=0)
 Open client socket on filename connected to servername.
 usocket (userversocket &srv, time_t delay, size_t bufsize)
 Construct a connection accepted by a server.
 ~usocket ()
 Destructor.
const std::string & servername () const
usockstreambufrdbuf (void) const
int error () const
 Return last system error.
std::string strerror () const

Static Public Member Functions

static shared_ptr< usocketaccept (userversocket &srv, time_t delay, size_t bufsize)
 Construct a connection accepted by a server.

Private Member Functions

 usocket (const usocket &)
usocketoperator= (const usocket &)

Private Attributes

std::string servername_
bool temp_

Detailed Description

Unix socket iostream specialization.

Definition at line 16 of file usocket.h.


Constructor & Destructor Documentation

Dv::Net::usocket::usocket ( const std::string &  servername,
time_t  millisecs = 0,
const std::string &  filename = "",
unsigned int  min_debug_level = 0,
Debugable debug_master = 0 
) [explicit]

Open client socket on filename connected to servername.

If filename has size 0, a temporary file will be created in /tmp .

Parameters:
servername filename of server
millisecs delay
filename 
min_debug_level if a debug_master is connected, logging info will only be written if the master's level is at least min_debug_level
debug_master from where debug info will be taken
See also:
Dv::DebugSlave
Dv::Net::usocket::usocket ( userversocket srv,
time_t  delay,
size_t  bufsize 
)

Construct a connection accepted by a server.

The debug_threshold and debug_master will be taken from the server.

Upon failure or timeout, the usocket is still created, but its failbit will be set, which can be checked as follows.

 usocket connection(server,10,bufsize);
 if (connection) {
   ..
 }

The delay (for I/O operations) of the new socket, is inherited from the Dv::Net::userversocket.

Parameters:
srv server doing the accept
delay (in millisecs) that we are prepared to wait, 0 means forever.
bufsize of resulting socket
Dv::Net::usocket::~usocket (  ) 

Destructor.

Dv::Net::usocket::usocket ( const usocket  )  [private]

Member Function Documentation

static shared_ptr<usocket> Dv::Net::usocket::accept ( userversocket srv,
time_t  delay,
size_t  bufsize 
) [static]

Construct a connection accepted by a server.

The debug_threshold and debug_master will be taken from the userversocket

Parameters:
srv server doing the accept
delay (in millisecs) that we are prepared to wait, 0 means forever.
bufsize of resulting socket
See also:
Dv::Net::usocket::usocket(userversocket& srv, time_t delay, size_t bufsize)
const std::string& Dv::Net::usocket::servername (  )  const [inline]
Returns:
filename of server.

Definition at line 61 of file usocket.h.

References servername_.

usockstreambuf* Dv::Net::usocket::rdbuf ( void   )  const [inline]
Returns:
associated usockstreambuf object.

Definition at line 63 of file usocket.h.

Referenced by error(), and strerror().

int Dv::Net::usocket::error (  )  const [inline]

Return last system error.

Definition at line 67 of file usocket.h.

References Dv::Util::fdstreambuf::error(), and rdbuf().

std::string Dv::Net::usocket::strerror (  )  const [inline]
Returns:
last system error string.

Definition at line 69 of file usocket.h.

References rdbuf(), and Dv::Util::fdstreambuf::strerror().

usocket& Dv::Net::usocket::operator= ( const usocket  )  [private]

Member Data Documentation

std::string Dv::Net::usocket::servername_ [private]

Definition at line 73 of file usocket.h.

Referenced by servername().

bool Dv::Net::usocket::temp_ [private]

Definition at line 74 of file usocket.h.


The documentation for this class was generated from the following file:

dvnet-0.9.24 [ 5 December, 2009]