Logo Search packages:      
Sourcecode: poco version File versions  Download package

Poco::Net::SocketImpl Class Reference

#include <SocketImpl.h>

Inheritance diagram for Poco::Net::SocketImpl:

Poco::RefCountedObject Poco::Net::DatagramSocketImpl Poco::Net::RawSocketImpl Poco::Net::ServerSocketImpl Poco::Net::StreamSocketImpl Poco::Net::ICMPSocketImpl Poco::Net::SecureServerSocketImpl Poco::Net::SecureStreamSocketImpl

List of all members.


Detailed Description

This class encapsulates the Berkeley sockets API.

Subclasses implement specific socket types like stream or datagram sockets.

You should not create any instances of this class.

Definition at line 54 of file SocketImpl.h.


Public Types

enum  SelectMode { SELECT_READ = 1, SELECT_WRITE = 2, SELECT_ERROR = 4 }

Public Member Functions

virtual SocketImplacceptConnection (SocketAddress &clientAddr)
virtual SocketAddress address ()
virtual int available ()
virtual void bind (const SocketAddress &address, bool reuseAddress=false)
virtual void close ()
virtual void connect (const SocketAddress &address, const Poco::Timespan &timeout)
virtual void connect (const SocketAddress &address)
virtual void connectNB (const SocketAddress &address)
void duplicate () const
bool getBroadcast ()
 Sets the value of the SO_BROADCAST socket option.
bool getKeepAlive ()
 Sets the value of the SO_KEEPALIVE socket option.
void getLinger (bool &on, int &seconds)
 Sets the value of the SO_LINGER socket option.
bool getNoDelay ()
 Sets the value of the TCP_NODELAY socket option.
bool getOOBInline ()
 Sets the value of the SO_OOBINLINE socket option.
void getOption (int level, int option, IPAddress &value)
void getOption (int level, int option, Poco::Timespan &value)
void getOption (int level, int option, unsigned char &value)
void getOption (int level, int option, unsigned &value)
void getOption (int level, int option, int &value)
virtual void getRawOption (int level, int option, void *value, poco_socklen_t &length)
virtual int getReceiveBufferSize ()
 Sets the size of the receive buffer.
virtual Poco::Timespan getReceiveTimeout ()
bool getReuseAddress ()
 Sets the value of the SO_REUSEADDR socket option.
bool getReusePort ()
virtual int getSendBufferSize ()
 Sets the size of the send buffer.
virtual Poco::Timespan getSendTimeout ()
 Sets the send timeout for the socket.
bool initialized () const
 A wrapper for the ioctl system call.
void ioctl (int request, void *arg)
 A wrapper for the ioctl system call.
void ioctl (int request, int &arg)
virtual void listen (int backlog=64)
virtual SocketAddress peerAddress ()
 Returns the IP address and port number of the socket.
virtual bool poll (const Poco::Timespan &timeout, int mode)
virtual int receiveBytes (void *buffer, int length, int flags=0)
virtual int receiveFrom (void *buffer, int length, SocketAddress &address, int flags=0)
int referenceCount () const
void release () const
 Increments the object's reference count.
virtual int sendBytes (const void *buffer, int length, int flags=0)
virtual int sendTo (const void *buffer, int length, const SocketAddress &address, int flags=0)
virtual void sendUrgent (unsigned char data)
void setBlocking (bool flag)
 Returns the value of the SO_BROADCAST socket option.
void setBroadcast (bool flag)
 Returns the value of the SO_OOBINLINE socket option.
void setKeepAlive (bool flag)
 Returns the value of the TCP_NODELAY socket option.
void setLinger (bool on, int seconds)
void setNoDelay (bool flag)
 Returns the value of the SO_LINGER socket option.
void setOOBInline (bool flag)
void setOption (int level, int option, const IPAddress &value)
void setOption (int level, int option, const Poco::Timespan &value)
void setOption (int level, int option, unsigned char value)
void setOption (int level, int option, unsigned value)
void setOption (int level, int option, int value)
 Returns the IP address and port number of the peer socket.
virtual void setRawOption (int level, int option, const void *value, poco_socklen_t length)
virtual void setReceiveBufferSize (int size)
virtual void setReceiveTimeout (const Poco::Timespan &timeout)
void setReuseAddress (bool flag)
 Returns the value of the SO_KEEPALIVE socket option.
void setReusePort (bool flag)
 Returns the value of the SO_REUSEADDR socket option.
virtual void setSendBufferSize (int size)
virtual void setSendTimeout (const Poco::Timespan &timeout)
virtual void shutdown ()
 Shuts down the sending part of the socket connection.
virtual void shutdownReceive ()
 Close the socket.
virtual void shutdownSend ()
 Shuts down the receiving part of the socket connection.
int socketError ()
poco_socket_t sockfd ()
 Returns the value of the SO_ERROR socket option.

Protected Member Functions

virtual void init (int af)
void initSocket (int af, int type, int proto=0)
void invalidate ()
 Allows subclasses to set the socket manually, iff no valid socket is set yet!
void setSockfd (poco_socket_t aSocket)
 SocketImpl (poco_socket_t sockfd)
 Creates a SocketImpl.
 SocketImpl ()
 Returns true iff the underlying socket is initialized.
virtual ~SocketImpl ()
 Creates a SocketImpl using the given native socket.

Static Protected Member Functions

static void error (int code, const std::string &arg)
 Throws an appropriate exception for the given error code.
static void error (int code)
 Throws an appropriate exception for the last error.
static void error (const std::string &arg)
 Throws an appropriate exception for the last error.
static void error ()
 Returns the last error code.
static int lastError ()

Private Member Functions

SocketImploperator= (const SocketImpl &)
 SocketImpl (const SocketImpl &)
 Throws an appropriate exception for the given error code.

Private Attributes

poco_socket_t _sockfd

Friends

class SecureSocketImpl
class Socket

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

Generated by  Doxygen 1.6.0   Back to index