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

P::Socket Class Reference
[Networking library]

Socket i/o device. More...

#include <psocket.h>

Inheritance diagram for P::Socket:

P::IODevice P::DatagramSocket P::StreamSocket P::StreamSocketServer P::FTPClient P::FTPData P::HTTPClient List of all members.

Public Types

enum  wait_t { pendingInput = 0x01, pendingOutput = 0x02 }
 Socket wait flags. More...


Public Member Functions

 Socket (int domain, int type, int proto) throw (IOError)
 Socket constructor.

 Socket (io_handle_t handle, int domain, int type, int proto) throw (IOError)
 Socket handle constructor.

 ~Socket () throw ()
void close () throw (IOError)
 Close the socket.

size_t write (const char *buffer, size_t count) throw (IOError)
 Write to device.

size_t peek (char *buffer, size_t count) throw (IOError)
 Peek incoming data on device.

size_t read (char *buffer, size_t count) throw (IOError)
 Read from device.

bool isSeekable () const throw ()
 Test if device is seekable.

int domain () const throw ()
 Protocol domain.

int type () const throw ()
 Socket type.

int protocol () const throw ()
 Socket protocol.

int wait (int wait, unsigned int timeout) throw (IOError)
 Wait for socket events.

void setBroadcast (bool enable) throw (IOError)
void setRouting (bool enable) throw (IOError)
void bind (const NetworkAddress &addr, port_t port) throw (IOError)
 Bind socket to given address and port.

void getName (NetworkAddress &addr, port_t &port) const throw (LogicError,IOError)
 Get name of socket.

void getPeer (NetworkAddress &addr, port_t &port) const throw (LogicError,IOError)
 Get address of peer.


Detailed Description

Socket i/o device.

Author:
Christian Prochnow <cproch@seculogix.de>

Definition at line 49 of file psocket.h.


Member Enumeration Documentation

enum P::Socket::wait_t
 

Socket wait flags.

Enumeration values:
pendingInput  Wait for pending input
pendingOutput  Wait for pending output

Definition at line 94 of file psocket.h.


Constructor & Destructor Documentation

P::Socket::Socket int  domain,
int  type,
int  proto
throw (IOError)
 

Socket constructor.

Constructs a socket for the given protocol domain, socket type and protocol. for and accept incoming client connections.

Parameters:
domain the protocol domain to use. supported domains are AF_INET, AF_INET6, AF_IPX and AF_ATALK.
type the socket type to use. (SOCK_STREAM, SOCK_DGRAM)
proto the protocol to use. use 0 for default.
Exceptions:
IOError 

P::Socket::Socket io_handle_t  handle,
int  domain,
int  type,
int  proto
throw (IOError)
 

Socket handle constructor.

P::Socket::~Socket  )  throw ()
 


Member Function Documentation

void P::Socket::bind const NetworkAddress addr,
port_t  port
throw (IOError)
 

Bind socket to given address and port.

void P::Socket::close  )  throw (IOError) [virtual]
 

Close the socket.

Reimplemented from P::IODevice.

Reimplemented in P::FTPClient, and P::StreamSocket.

int P::Socket::domain  )  const throw () [inline]
 

Protocol domain.

Definition at line 82 of file psocket.h.

void P::Socket::getName NetworkAddress addr,
port_t port
const throw (LogicError,IOError)
 

Get name of socket.

Reimplemented in P::StreamSocketServer.

void P::Socket::getPeer NetworkAddress addr,
port_t port
const throw (LogicError,IOError)
 

Get address of peer.

bool P::Socket::isSeekable  )  const throw () [inline, virtual]
 

Test if device is seekable.

Reimplemented from P::IODevice.

Definition at line 78 of file psocket.h.

size_t P::Socket::peek char *  buffer,
size_t  count
throw (IOError) [virtual]
 

Peek incoming data on device.

Retrieves data from the receive queue without removing it.

Parameters:
buffer pointer to buffer receiving the data
count size of the buffer
Returns:
number of received bytes

Reimplemented from P::IODevice.

Reimplemented in P::DatagramSocket.

int P::Socket::protocol  )  const throw () [inline]
 

Socket protocol.

Definition at line 90 of file psocket.h.

size_t P::Socket::read char *  buffer,
size_t  count
throw (IOError) [virtual]
 

Read from device.

Reimplemented from P::IODevice.

Reimplemented in P::FTPData, and P::DatagramSocket.

void P::Socket::setBroadcast bool  enable  )  throw (IOError)
 

void P::Socket::setRouting bool  enable  )  throw (IOError)
 

int P::Socket::type  )  const throw () [inline]
 

Socket type.

Reimplemented in P::FTPClient.

Definition at line 86 of file psocket.h.

int P::Socket::wait int  wait,
unsigned int  timeout
throw (IOError)
 

Wait for socket events.

Parameters:
wait mask of wait flags specifying for which events we should wait
timeout the timeout in milliseconds to wait
Exceptions:
IOError 

size_t P::Socket::write const char *  buffer,
size_t  count
throw (IOError) [virtual]
 

Write to device.

Reimplemented from P::IODevice.

Reimplemented in P::FTPData, and P::DatagramSocket.


The documentation for this class was generated from the following file:
Generated on Fri Mar 12 21:08:36 2004 for P::Classes by doxygen 1.3.3