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

WvTCPListener Class Reference

#include <wvtcp.h>

Inheritance diagram for WvTCPListener:

WvStream WvStream List of all members.

Public Methods

 WvTCPListener (const WvIPPortAddr &_listenport)
virtual ~WvTCPListener ()
virtual void close ()
WvTCPConnaccept ()
void auto_accept (WvStreamList *list, WvStreamCallback callfunc=NULL, void *userdata=NULL)
virtual size_t uread (void *buf, size_t len)
virtual size_t uwrite (const void *buf, size_t len)
virtual const WvIPPortAddrsrc () const
 WvTCPListener (const WvIPPortAddr &_listenport)
virtual ~WvTCPListener ()
virtual void close ()
WvTCPConnaccept ()
void auto_accept (WvStreamList *list, WvStreamCallback callfunc=NULL, void *userdata=NULL)
virtual size_t uread (void *buf, size_t len)
virtual size_t uwrite (const void *buf, size_t len)
virtual const WvIPPortAddrsrc () const

Static Protected Methods

void accept_callback (WvStream &s, void *userdata)
void accept_callback (WvStream &s, void *userdata)

Protected Attributes

WvIPPortAddr listenport
WvStreamListauto_list
WvStreamCallback auto_callback
void * auto_userdata
WvStreamListauto_list
void * auto_userdata

Detailed Description

Class to easily create the Server side of a TCPConn...

Definition at line 123 of file include/wvtcp.h.


Constructor & Destructor Documentation

WvTCPListener::WvTCPListener const WvIPPortAddr   _listenport
 

Create a WvStream that listens on _listenport of the current machine This is how you set up a TCP Server.

Definition at line 236 of file wvtcp.cc.

References auto_list, auto_userdata, WvStream::getfd, listenport, WvIPPortAddr::port, WvStream::rwfd, WvStream::seterr, WvIPPortAddr::sockaddr, and WvIPAddr::sockaddr_len.

WvTCPListener::~WvTCPListener   [virtual]
 

Destructor - remember - close() is your friend ;)

Definition at line 271 of file wvtcp.cc.

References close.

WvTCPListener::WvTCPListener const WvIPPortAddr   _listenport
 

Create a WvStream that listens on _listenport of the current machine This is how you set up a TCP Server.

virtual WvTCPListener::~WvTCPListener   [virtual]
 

Destructor - remember - close() is your friend ;)


Member Function Documentation

WvTCPConn* WvTCPListener::accept  
 

return a new WvTCPConn socket corresponding to a newly-accepted connection. If no connection is ready immediately, we wait for one indefinitely. You can use select(read=true) to check for a waiting connection.

WvTCPConn * WvTCPListener::accept  
 

return a new WvTCPConn socket corresponding to a newly-accepted connection. If no connection is ready immediately, we wait for one indefinitely. You can use select(read=true) to check for a waiting connection.

Definition at line 288 of file wvtcp.cc.

References WvStream::getfd.

Referenced by accept_callback.

void WvTCPListener::accept_callback WvStream   s,
void *    userdata
[static, protected]
 

void WvTCPListener::accept_callback WvStream   s,
void *    userdata
[static, protected]
 

Definition at line 311 of file wvtcp.cc.

References accept, WvList< WvStream >::append, auto_callback, auto_list, auto_userdata, WvStream::setcallback, and WvStream::userdata.

Referenced by auto_accept.

void WvTCPListener::auto_accept WvStreamList   list,
WvStreamCallback    callfunc = NULL,
void *    userdata = NULL
 

set a callback() function that automatically accepts new WvTCPConn connections, assigning them their own callback function 'callfunc' with parameter 'userdata.' Pass list==NULL or define your own own callback function to disable auto-accepting.

Be careful not to accept() connections yourself if you do this, or we may end up accept()ing twice, causing a hang the second time.

void WvTCPListener::auto_accept WvStreamList   list,
WvStreamCallback    callfunc = NULL,
void *    userdata = NULL
 

set a callback() function that automatically accepts new WvTCPConn connections, assigning them their own callback function 'callfunc' with parameter 'userdata.' Pass list==NULL or define your own own callback function to disable auto-accepting.

Be careful not to accept() connections yourself if you do this, or we may end up accept()ing twice, causing a hang the second time.

Definition at line 301 of file wvtcp.cc.

References accept_callback, auto_callback, auto_list, auto_userdata, WvStream::setcallback, and WvStream::userdata.

Referenced by main.

virtual void WvTCPListener::close   [virtual]
 

Shut down the server, and disconnect from the port

Reimplemented from WvStream.

void WvTCPListener::close   [virtual]
 

Shut down the server, and disconnect from the port

Reimplemented from WvStream.

Definition at line 278 of file wvtcp.cc.

References WvStream::close.

Referenced by ~WvTCPListener.

virtual const WvIPPortAddr* WvTCPListener::src   const [virtual]
 

src() is a bit of a misnomer, but it returns the listener port.

Reimplemented from WvStream.

const WvIPPortAddr * WvTCPListener::src   const [virtual]
 

src() is a bit of a misnomer, but it returns the listener port.

Reimplemented from WvStream.

Definition at line 333 of file wvtcp.cc.

References listenport.

virtual size_t WvTCPListener::uread void *    buf,
size_t    len
[virtual]
 

these don't do anything, but they confuse the socket, so we'll ignore them on purpose.

Reimplemented from WvStream.

size_t WvTCPListener::uread void *    buf,
size_t    len
[virtual]
 

these don't do anything, but they confuse the socket, so we'll ignore them on purpose.

Reimplemented from WvStream.

Definition at line 321 of file wvtcp.cc.

virtual size_t WvTCPListener::uwrite const void *    buf,
size_t    len
[virtual]
 

unbuffered I/O functions; these ignore the buffer, which is handled by write(). Don't call these functions unless you have a _really_ good reason.

Reimplemented from WvStream.

size_t WvTCPListener::uwrite const void *    buf,
size_t    len
[virtual]
 

unbuffered I/O functions; these ignore the buffer, which is handled by write(). Don't call these functions unless you have a _really_ good reason.

Reimplemented from WvStream.

Definition at line 327 of file wvtcp.cc.


Member Data Documentation

WvStreamCallback WvTCPListener::auto_callback [protected]
 

Definition at line 177 of file ipstreams/wvtcp.h.

Referenced by accept_callback, and auto_accept.

WvStreamList* WvTCPListener::auto_list [protected]
 

Definition at line 176 of file ipstreams/wvtcp.h.

WvStreamList* WvTCPListener::auto_list [protected]
 

Definition at line 176 of file include/wvtcp.h.

Referenced by accept_callback, auto_accept, and WvTCPListener.

void* WvTCPListener::auto_userdata [protected]
 

Definition at line 178 of file ipstreams/wvtcp.h.

void* WvTCPListener::auto_userdata [protected]
 

Definition at line 178 of file include/wvtcp.h.

Referenced by accept_callback, auto_accept, and WvTCPListener.

WvIPPortAddr WvTCPListener::listenport [protected]
 

Definition at line 175 of file ipstreams/wvtcp.h.

Referenced by src, and WvTCPListener.


The documentation for this class was generated from the following files:
Generated on Sun Aug 25 02:29:47 2002 for WvStreams by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002