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

WvUDPStream Class Reference

#include <wvudp.h>

Inheritance diagram for WvUDPStream:

WvStream WvStream List of all members.

Public Methods

 WvUDPStream (const WvIPPortAddr &_local, const WvIPPortAddr &_rem)
virtual ~WvUDPStream ()
const WvAddr * local () const
virtual const WvAddr * src () const
void setdest (const WvIPPortAddr &_remaddr)
void enable_broadcasts ()
 WvUDPStream (const WvIPPortAddr &_local, const WvIPPortAddr &_rem)
virtual ~WvUDPStream ()
const WvAddr * local () const
virtual const WvAddr * src () const
void setdest (const WvIPPortAddr &_remaddr)
void enable_broadcasts ()

Protected Methods

virtual size_t uread (void *buf, size_t count)
virtual size_t uwrite (const void *buf, size_t count)
virtual size_t uread (void *buf, size_t count)
virtual size_t uwrite (const void *buf, size_t count)

Protected Attributes

WvIPPortAddr localaddr
WvIPPortAddr remaddr

Detailed Description

WvUDPStream can send and receive packets on a connectionless UDP socket.

In the constructor, the socket is attached using bind() to the given _local address. If the address is 0.0.0.0, all addresses on the local host are used; if the port is 0, an available port number is chosen automatically.

If the _rem address is 0.0.0.0, the port is not connect()ed. That means it can receive packets from anywhere and send them to anywhere. The src() and setdest() functions are useful for this. If _rem is not 0.0.0.0, connect() is called and the socket will only accept data to/from the specified remote UDP address.

Buffering: all the usual WvStream-style input buffering is available, including getline(), but because input packets may get lost it is of limited usefulness. Buffering will cause particular confusion if the socket is not connect()ed.

Definition at line 30 of file include/wvudp.h.


Constructor & Destructor Documentation

WvUDPStream::WvUDPStream (  const WvIPPortAddr &    _local,
const WvIPPortAddr &    _rem
) 
 

connect a new socket

Definition at line 13 of file wvudp.cc.

References WvStream::getfd(), localaddr, WvStream::rwfd, WvStream::seterr(), WvIPPortAddr::sockaddr(), and WvIPAddr::sockaddr_len().

WvUDPStream::~WvUDPStream (    )  [virtual]
 

Definition at line 58 of file wvudp.cc.

WvUDPStream::WvUDPStream (  const WvIPPortAddr &    _local,
const WvIPPortAddr &    _rem
) 
 

connect a new socket

virtual WvUDPStream::~WvUDPStream (    )  [virtual]
 


Member Function Documentation

void WvUDPStream::enable_broadcasts (    ) 
 

void WvUDPStream::enable_broadcasts (    ) 
 

Definition at line 111 of file wvudp.cc.

References WvStream::getfd(), and WvStream::isok().

const WvAddr* WvUDPStream::local (    )  const
 

const WvAddr * WvUDPStream::local (    )  const
 

Definition at line 69 of file wvudp.cc.

References localaddr.

void WvUDPStream::setdest (  const WvIPPortAddr &    _remaddr )  [inline]
 

Definition at line 47 of file ipstreams/wvudp.h.

References remaddr.

void WvUDPStream::setdest (  const WvIPPortAddr &    _remaddr )  [inline]
 

Definition at line 47 of file include/wvudp.h.

References remaddr.

virtual const WvAddr* WvUDPStream::src (    )  const [virtual]
 

return the remote address (source of incoming packets, target of outgoing packets). This is the last host sent to or received from, whichever was more recent.

Reimplemented from WvStream.

const WvAddr * WvUDPStream::src (    )  const [virtual]
 

return the remote address (source of incoming packets, target of outgoing packets). This is the last host sent to or received from, whichever was more recent.

Reimplemented from WvStream.

Definition at line 63 of file wvudp.cc.

References remaddr.

virtual size_t WvUDPStream::uread (  void *    buf,
size_t    count
)  [protected, virtual]
 

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

Reimplemented from WvStream.

size_t WvUDPStream::uread (  void *    buf,
size_t    count
)  [protected, virtual]
 

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

Reimplemented from WvStream.

Definition at line 75 of file wvudp.cc.

References WvStream::getfd(), WvStream::isok(), and remaddr.

virtual size_t WvUDPStream::uwrite (  const void *    buf,
size_t    count
)  [protected, 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 WvUDPStream::uwrite (  const void *    buf,
size_t    count
)  [protected, 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 91 of file wvudp.cc.

References WvStream::getfd(), WvStream::isok(), remaddr, WvStream::seterr(), WvIPPortAddr::sockaddr(), and WvIPAddr::sockaddr_len().


Member Data Documentation

WvIPPortAddr WvUDPStream::localaddr [protected]
 

Definition at line 53 of file ipstreams/wvudp.h.

Referenced by local(), and WvUDPStream().

WvIPPortAddr WvUDPStream::remaddr [protected]
 

Definition at line 53 of file ipstreams/wvudp.h.

Referenced by setdest(), src(), uread(), and uwrite().


The documentation for this class was generated from the following files:
Generated on Fri Apr 5 15:16:57 2002 for WvStreams by doxygen1.2.15