skstream
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dgram_socketbuf Class Reference

A stream buffer class that handles datagram sockets. More...

#include <skstream.h>

Inheritance diagram for dgram_socketbuf:
socketbuf

Public Member Functions

 dgram_socketbuf (SOCKET_TYPE sock, std::streamsize insize=0x8000, std::streamsize outsize=0x8000)
 
 dgram_socketbuf (SOCKET_TYPE sock, std::streambuf::char_type *buf, std::streamsize length)
 
virtual ~dgram_socketbuf ()
 Destroy the socket buffer.
 
bool setTarget (const std::string &address, unsigned port, int proto)
 
void setOutpeer (const sockaddr_storage &peer)
 
const sockaddr_storage & getOutpeer () const
 
const sockaddr_storage & getInpeer () const
 
SOCKLEN getOutpeerSize () const
 
SOCKLEN getInpeerSize () const
 
- Public Member Functions inherited from socketbuf
 socketbuf (SOCKET_TYPE sock, std::streamsize insize=0x8000, std::streamsize outsize=0x8000)
 
 socketbuf (SOCKET_TYPE sock, std::streambuf::char_type *buf, std::streamsize length)
 
virtual ~socketbuf ()
 Destroy the socket buffer.
 
void setSocket (SOCKET_TYPE sock)
 Set the existing socket that this buffer should use.
 
SOCKET_TYPE getSocket () const
 Get the socket that this buffer uses.
 
void setReadTimeout (unsigned sec, unsigned usec=0)
 
void setWriteTimeout (unsigned sec, unsigned usec=0)
 
void setTimeout (unsigned sec, unsigned usec=0)
 
bool timeout () const
 Return the flag indicating whether a timeout has occured.
 

Protected Member Functions

virtual int_type overflow (int_type nCh=traits_type::eof())
 Handle writing data from the buffer to the socket. More...
 
virtual int_type underflow ()
 Handle reading data from the socket to the buffer.
 
- Protected Member Functions inherited from socketbuf
virtual int sync ()
 Flush the output buffer.
 
std::streambuf * setbuf (std::streambuf::char_type *buf, std::streamsize len)
 

Protected Attributes

sockaddr_storage out_peer
 Target address of datagrams sent via this stream.
 
sockaddr_storage in_peer
 Source address of last datagram received by this stream.
 
SOCKLEN out_p_size
 Size of target address.
 
SOCKLEN in_p_size
 Size of source address.
 
- Protected Attributes inherited from socketbuf
SOCKET_TYPE _socket
 
timeval _underflow_timeout
 
timeval _overflow_timeout
 
bool Timeout
 

Detailed Description

A stream buffer class that handles datagram sockets.

Constructor & Destructor Documentation

dgram_socketbuf::dgram_socketbuf ( SOCKET_TYPE  sock,
std::streamsize  insize = 0x8000,
std::streamsize  outsize = 0x8000 
)
explicit

Make a new socket buffer from an existing socket, with optional buffer sizes.

dgram_socketbuf::dgram_socketbuf ( SOCKET_TYPE  sock,
std::streambuf::char_type *  buf,
std::streamsize  length 
)

Make a new socket buffer from an existing socket, with an existing buffer.

Member Function Documentation

int_type dgram_socketbuf::overflow ( int_type  nCh = traits_type::eof())
protectedvirtual

Handle writing data from the buffer to the socket.

Handle output to a connected socket.

Implements socketbuf.

References out_p_size, and out_peer.


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