GNet::StreamSocket Class Reference

A derivation of Socket for a stream socket. More...

#include <gsocket.h>

Inheritance diagram for GNet::StreamSocket:

GNet::Socket

List of all members.

Public Types

typedef Socket::size_type size_type
typedef Socket::ssize_type ssize_type

Public Member Functions

 StreamSocket ()
 Default constructor. Check with valid().
 StreamSocket (const Address &address_hint)
 Constructor with a hint of the bind()/connect() address to be used later.
virtual ~StreamSocket ()
 Destructor.
ssize_type read (char *buffer, size_type buffer_length)
 Reads data from the socket stream.
AcceptPair accept ()
 Accepts an incoming connection, returning a new()ed socket and the peer address.


Detailed Description

A derivation of Socket for a stream socket.

Definition at line 273 of file gsocket.h.


Member Typedef Documentation

Reimplemented from GNet::Socket.

Definition at line 276 of file gsocket.h.

Reimplemented from GNet::Socket.

Definition at line 277 of file gsocket.h.


Constructor & Destructor Documentation

GNet::StreamSocket::StreamSocket (  ) 

Default constructor. Check with valid().

Definition at line 305 of file gsocket.cpp.

References GNet::Socket::setKeepAlive(), and GNet::Socket::setNoLinger().

Referenced by accept().

GNet::StreamSocket::StreamSocket ( const Address address_hint  )  [explicit]

Constructor with a hint of the bind()/connect() address to be used later.

Check with valid().

Definition at line 312 of file gsocket.cpp.

References GNet::Socket::setKeepAlive(), and GNet::Socket::setNoLinger().

GNet::StreamSocket::~StreamSocket (  )  [virtual]

Destructor.

Definition at line 324 of file gsocket.cpp.


Member Function Documentation

GNet::Socket::ssize_type GNet::StreamSocket::read ( char *  buffer,
size_type  buffer_length 
)

Reads data from the socket stream.

Returns 0 if the connection has been lost. Returns -1 on error, or if there is nothing to read (eWouldBlock() true). Note that having nothing to read is not an error, even after getting a read event.

Definition at line 328 of file gsocket.cpp.

References G_ASSERT, G_DEBUG, GNet::Socket::m_reason, GNet::Socket::m_socket, GNet::Socket::reason(), GNet::Socket::sizeError(), and GNet::Socket::valid().

GNet::AcceptPair GNet::StreamSocket::accept (  ) 

Accepts an incoming connection, returning a new()ed socket and the peer address.

Definition at line 346 of file gsocket.cpp.

References GNet::AcceptPair::first, G_DEBUG, GNet::Address::invalidAddress(), GNet::Socket::m_reason, GNet::Socket::m_socket, GNet::Socket::reason(), GNet::AcceptPair::second, StreamSocket(), and GNet::Socket::valid().


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

Generated on Fri Apr 18 15:56:13 2008 for E-MailRelay by  doxygen 1.5.5