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

dsServerSocket Class Reference

#include <dsSocket.h>

Inheritance diagram for dsServerSocket:

dsSocket dsSocketBase List of all members.

Public Methods

void Listen (int port)
int Accept ()
int srvsocket ()
virtual void Close ()
void Open (const int proto=IPPROTO_UDP, const int fcntl_flags=0)
virtual void Connect (const char *host, const int port, const int proto=IPPROTO_TCP)
virtual size_t __read (char *buf, size_t bytes)
virtual size_t __write (const char *ptr, size_t bytes)
virtual size_t __sendto (const char *buf, size_t bytes, const sockaddr *to, socklen_t len)
size_t Sendto (const char *ptr, size_t bytes, const char *host, const int port)
unsigned long getip ()
unsigned long getpeerip ()
unsigned int getport ()
char * getpeer_aip ()
char * get_aip ()
int fd () const
size_t Read (char *buffer, size_t bytes, int sec=10, int usec=0)
size_t Read (std::ostream &os, int sec=10, int usec=0)
size_t Write (const char *buffer, size_t bytes, int sec=10, int usec=0)
size_t Write (std::istream &is, int sec=10, int usec=0)
size_t Write (const char *str, int sec=10, int usec=0)
size_t Printf (const char *format,...)
size_t ReadLine (std::ostream &os, int sec=10)
size_t ReadLine (char *buf, size_t size, int sec=10)
size_t WriteLine (std::istream &is, int sec=10)
size_t WriteLine (const char *str, int sec=10)

Protected Attributes

sockaddr_in _sockAddr
hostent * _pHostEnt
int _sock

Member Function Documentation

size_t dsSocket::__read char *    buf,
size_t    bytes
[virtual, inherited]
 

Implements dsSocketBase.

Reimplemented in dsSSLSocket.

size_t dsSocket::__sendto const char *    buf,
size_t    bytes,
const sockaddr *    to,
socklen_t    len
[virtual, inherited]
 

size_t dsSocket::__write const char *    ptr,
size_t    bytes
[virtual, inherited]
 

Implements dsSocketBase.

Reimplemented in dsSSLSocket.

int dsServerSocket::Accept  
 

void dsServerSocket::Close   [virtual]
 

Reimplemented from dsSocket.

void dsSocket::Connect const char *    host,
const int    port,
const int    proto = IPPROTO_TCP
[virtual, inherited]
 

Don't add O_NONBLOCK by default because it require another way of error * and timeout handling

If I chouse to set O_NONBLOCK by default, code should looks like this:

#ifdef POSIX_OS int fl = fcntl(_sock, F_GETFL, 0); fcntl(_sock, F_SETFL, fl | O_NONBLOCK); #endif

Implements dsSocketBase.

int dsSocketBase::fd   const [inline, inherited]
 

char * dsSocket::get_aip   [inherited]
 

unsigned long dsSocket::getip   [inherited]
 

char * dsSocket::getpeer_aip   [inherited]
 

unsigned long dsSocket::getpeerip   [inherited]
 

unsigned int dsSocket::getport   [inherited]
 

void dsServerSocket::Listen int    port
 

void dsSocket::Open const int    proto = IPPROTO_UDP,
const int    fcntl_flags = 0
[inherited]
 

size_t dsSocketBase::Printf const char *    format,
...   
[inherited]
 

size_t dsSocketBase::Read std::ostream &    os,
int    sec = 10,
int    usec = 0
[inherited]
 

size_t dsSocketBase::Read char *    buffer,
size_t    bytes,
int    sec = 10,
int    usec = 0
[inherited]
 

Read/Write data from network

The main difference from raw read/write, that socket covered by select and as result, these functions doesn't block for more than timeout.

size_t dsSocketBase::ReadLine char *    buf,
size_t    size,
int    sec = 10
[inherited]
 

size_t dsSocketBase::ReadLine std::ostream &    os,
int    sec = 10
[inherited]
 

ReadLine

Parameters:
os stream to store data
sec maximal wait time

size_t dsSocket::Sendto const char *    ptr,
size_t    bytes,
const char *    host,
const int    port
[inherited]
 

int dsServerSocket::srvsocket   [inline]
 

size_t dsSocketBase::Write const char *    str,
int    sec = 10,
int    usec = 0
[inline, inherited]
 

size_t dsSocketBase::Write std::istream &    is,
int    sec = 10,
int    usec = 0
[inherited]
 

size_t dsSocketBase::Write const char *    buffer,
size_t    bytes,
int    sec = 10,
int    usec = 0
[inherited]
 

size_t dsSocketBase::WriteLine const char *    str,
int    sec = 10
[inherited]
 

size_t dsSocketBase::WriteLine std::istream &    is,
int    sec = 10
[inherited]
 


Member Data Documentation

struct hostent* dsSocket::_pHostEnt [protected, inherited]
 

int dsSocketBase::_sock [protected, inherited]
 

struct sockaddr_in dsSocket::_sockAddr [protected, inherited]
 


The documentation for this class was generated from the following files:
Generated on Mon May 16 18:27:00 2005 for libdms4 by doxygen1.3-rc2