Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

Stream Class Reference

#include <cxxtools/tcpstream.h>

Inheritance diagram for Stream:

Socket iostream List of all members.

Public Types

typedef size_t size_type

Public Member Functions

 Stream ()
 initialize an empty stream socket
 Stream (const Server &server)
 initialize and accepts a connection from a server.
 Stream (const std::string &ipaddr, unsigned short int port)
 Creates a connected socket to the specified ip adress.
 Stream (int fd)
void accept (const Server &server)
 On error a exception of type cxxtools::net::Exception is thrown.
void connect (const std::string &ipaddr, unsigned short int port)
 Connects to the passed ip address.
size_type read (char *buffer, size_type bufsize) const
 reads up to bufsize bytes from the socket.
size_type write (const char *buffer, size_type bufsize, bool flush=true) const
sockaddr_storage & getPeeraddr () const
 returns the current peer address.

Detailed Description

Stream client socket.

Stream is a unbuffered client stream socket.


Constructor & Destructor Documentation

Stream ( int  fd  )  [explicit]

Creates a socket from an existing file descriptor. The class takes the ownership of this descriptor. That means, that the descriptor is closed, when the stream is destroyed.


Member Function Documentation

size_type write ( const char *  buffer,
size_type  bufsize,
bool  flush = true 
) const

Writes up to bufsize bytes to the socket. If flush is not set, the write may return after less than bufsize bytes are sent.

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6