Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

Socket Class Reference

#include <Socket.h>

Inheritance diagram for Socket:

ISocket SSLSocket List of all members.

Public Methods

virtual ~Socket ()=0
int writeLine (string msg)
int writeLine (const char *msg)
bool startBinaryTransfer (int64_t length, int packetSize)
int readBinary (uint8_t *buffer, int maxlen)
int writeBinary (const uint8_t *buffer, int length)
virtual int readLine (string &msg)=0
virtual void interrupt ()=0
virtual void close ()

Protected Methods

virtual int readBlock (void *buffer, int maxlen)=0
virtual int writeBlock (const void *buffer, int length)=0

Detailed Description

This is the base class for sockets.


Constructor & Destructor Documentation

Socket::~Socket   [pure virtual]
 

Destructor. Close and delete this socket.


Member Function Documentation

void Socket::close   [virtual]
 

Close the socket.

Reimplemented in ISocket.

virtual void Socket::interrupt   [pure virtual]
 

Interrupt current read actions (socket becomes write-only).

Implemented in ISocket, and SSLSocket.

int Socket::readBinary uint8_t *    buffer,
int    maxlen
 

Read binary packet data from the socket.

Parameters:
buffer  a pointer to the data.
maxlen  the maximum number of bytes to read.
Returns:
the number of bytes actually read or -1 on failure.

virtual int Socket::readBlock void *    buffer,
int    maxlen
[protected, pure virtual]
 

Reads raw bytes from the socket for binary data transmission.

Parameters:
buffer  a pointer to the data.
maxlen  the maximum number of bytes to read.
Returns:
the number of bytes actually read or -1 on failure.

Implemented in ISocket, and SSLSocket.

virtual int Socket::readLine string &    msg [pure virtual]
 

Read a single line of ASCII data (CR/LF automatically removed).

Parameters:
msg  the string that receives the ASCII data
Returns:
the number of bytes actually read or -1 on failure.

Implemented in ISocket, and SSLSocket.

bool Socket::startBinaryTransfer int64_t    length,
int    packetSize
 

Start transfer of binary packet data.

Parameters:
length 
packetSize  the binary packet size (0 for clients)
Returns:
true if initialized succesfully, false otherwise

int Socket::writeBinary const uint8_t *    buffer,
int    length
 

Write binary packet data to the socket.

Parameters:
buffer  a pointer to the data.
length  the length of the data buffer in bytes.
Returns:
the number of bytes actually written or -1 on failure

virtual int Socket::writeBlock const void *    buffer,
int    length
[protected, pure virtual]
 

Writes raw data to the socket for binary data transmission.

Parameters:
buffer  a pointer to the data.
length  the length of the data buffer in bytes.
Returns:
the number of bytes actually written or -1 on failure

Implemented in ISocket, and SSLSocket.

int Socket::writeLine const char *    msg
 

Write a single line of ASCII data (CR/LF automatically added).

Parameters:
msg  the string to send
msg  the zero-terminated string to send
Returns:
the number of bytes actually written or -1 on failure.

int Socket::writeLine string    msg
 

Write a single line of ASCII data (CR/LF automatically added).

Parameters:
msg  the C++ string to send
Returns:
the number of bytes actually written or -1 on failure.


The documentation for this class was generated from the following files:
Generated on Wed Feb 18 13:45:57 2004 for strongroom by doxygen1.2.18