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

Poco::Net::DialogSocket Class Reference

#include <DialogSocket.h>

Inheritance diagram for Poco::Net::DialogSocket:

Poco::Net::StreamSocket Poco::Net::Socket

List of all members.


Detailed Description

DialogSocket is a subclass of StreamSocket that can be used for implementing request-response based client server connections.

A request is always a single-line command terminated by CR-LF.

A response can either be a single line of text terminated by CR-LF, or multiple lines of text in the format used by the FTP and SMTP protocols.

Limited support for the TELNET protocol (RFC 854) is available.

Definition at line 51 of file DialogSocket.h.


Public Types

enum  SelectMode { SELECT_READ = 1, SELECT_WRITE = 2, SELECT_ERROR = 4 }
 The mode argument to poll() and select().
typedef std::vector< SocketSocketList
enum  TelnetCodes {
  TELNET_SE = 240, TELNET_NOP = 241, TELNET_DM = 242, TELNET_BRK = 243,
  TELNET_IP = 244, TELNET_AO = 245, TELNET_AYT = 246, TELNET_EC = 247,
  TELNET_EL = 248, TELNET_GA = 249, TELNET_SB = 250, TELNET_WILL = 251,
  TELNET_WONT = 252, TELNET_DO = 253, TELNET_DONT = 254, TELNET_IAC = 255
}

Public Member Functions

SocketAddress address () const
int available () const
void close ()
 Compares the SocketImpl pointers.
void connect (const SocketAddress &address, const Poco::Timespan &timeout)
void connect (const SocketAddress &address)
void connectNB (const SocketAddress &address)
 DialogSocket (const Socket &socket)
 DialogSocket (const SocketAddress &address)
int get ()
bool getKeepAlive () const
 Sets the value of the SO_KEEPALIVE socket option.
void getLinger (bool &on, int &seconds) const
 Sets the value of the SO_LINGER socket option.
bool getNoDelay () const
 Sets the value of the TCP_NODELAY socket option.
bool getOOBInline () const
 Sets the value of the SO_OOBINLINE socket option.
void getOption (int level, int option, IPAddress &value) const
void getOption (int level, int option, Poco::Timespan &value) const
void getOption (int level, int option, unsigned char &value) const
void getOption (int level, int option, unsigned &value) const
void getOption (int level, int option, int &value) const
int getReceiveBufferSize () const
 Sets the size of the receive buffer.
Poco::Timespan getReceiveTimeout () const
bool getReuseAddress () const
 Sets the value of the SO_REUSEADDR socket option.
bool getReusePort () const
int getSendBufferSize () const
 Sets the size of the send buffer.
Poco::Timespan getSendTimeout () const
 Sets the send timeout for the socket.
SocketImplimpl () const
 Returns the IP address and port number of the peer socket.
bool operator!= (const Socket &socket) const
bool operator< (const Socket &socket) const
bool operator<= (const Socket &socket) const
 Compares the SocketImpl pointers.
DialogSocketoperator= (const Socket &socket)
 Destroys the DialogSocket.
bool operator== (const Socket &socket) const
bool operator> (const Socket &socket) const
 Compares the SocketImpl pointers.
bool operator>= (const Socket &socket) const
 Compares the SocketImpl pointers.
int peek ()
SocketAddress peerAddress () const
 Returns the IP address and port number of the socket.
bool poll (const Poco::Timespan &timeout, int mode) const
int receiveBytes (void *buffer, int length, int flags=0)
bool receiveMessage (std::string &message)
int receiveStatusMessage (std::string &message)
void sendByte (unsigned char ch)
int sendBytes (const void *buffer, int length, int flags=0)
void sendMessage (const std::string &message, const std::string &arg1, const std::string &arg2)
void sendMessage (const std::string &message, const std::string &arg)
void sendMessage (const std::string &message)
 Sends the given string over the socket connection.
void sendString (const std::string &str)
void sendString (const char *str)
 Sends a single byte over the socket connection.
void sendTelnetCommand (unsigned char command, unsigned char arg)
void sendTelnetCommand (unsigned char command)
void sendUrgent (unsigned char data)
void setBlocking (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)
void setReceiveBufferSize (int size)
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.
void setSendBufferSize (int size)
void setSendTimeout (const Poco::Timespan &timeout)
void shutdown ()
 Shuts down the sending part of the socket connection.
void shutdownReceive ()
void shutdownSend ()
 Shuts down the receiving part of the socket connection.
void synch ()
 ~DialogSocket ()

Static Public Member Functions

static int select (SocketList &readList, SocketList &writeList, SocketList &exceptList, const Poco::Timespan &timeout)
 Closes the socket.
static bool supportsIPv4 ()
 Returns the SocketImpl for this socket.
static bool supportsIPv6 ()
 Returns true if the system supports IPv4.

Protected Member Functions

void allocBuffer ()
bool receiveLine (std::string &line)
int receiveStatusLine (std::string &line)
void refill ()
poco_socket_t sockfd () const

Private Types

enum  { RECEIVE_BUFFER_SIZE = 1024, EOF_CHAR = -1 }

Private Attributes

char * _pBuffer
char * _pEnd
char * _pNext

Friends

class ServerSocket
class SocketIOS

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

Generated by  Doxygen 1.6.0   Back to index