psocksxx
1.0.0
|
Network (IPv4) controller class. More...
#include <nsockstream.h>
Public Member Functions | |
nsockstream (sockstreambuf::socket_type_t type, sockstreambuf::socket_protocol_t proto) throw ( sockexception ) | |
constructor More... | |
nsockstream (sockstreambuf *ssb) throw () | |
constructor More... | |
virtual | ~nsockstream () throw () |
destructor | |
void | connect (const nsockaddr *saddr) throw ( sockexception, socktimeoutexception ) |
connect to a network address More... | |
void | connect (const char *node, unsigned int port) throw ( sockexception, socktimeoutexception ) |
connect to a network address More... | |
void | bind (const nsockaddr *saddr, bool reuse_addr=false) throw ( sockexception ) |
bind the stream to a network address More... | |
void | listen (int backlog=0) throw ( sockexception ) |
make this stream passive and ready to accept connections More... | |
nsockstream * | accept () throw ( sockexception ) |
accept a connection on a listening (passive) stream More... | |
![]() | |
iosockstream (sockstreambuf *ssb) throw () | |
constructor More... | |
virtual | ~iosockstream () throw () |
destructor | |
bool | timedout () const throw () |
get the timed-out status for this stream More... | |
![]() | |
isockstream (sockstreambuf *ssb) throw () | |
constructor More... | |
virtual | ~isockstream () throw () |
destructor | |
![]() | |
virtual | ~iosocks () throw () |
destructor More... | |
bool | timedout () const throw () |
get the timed-out status flag value More... | |
const timeval * | timeout (time_t sec, suseconds_t usec) throw () |
set the timeout value for stream communications More... | |
void * | clear_timeout () throw () |
clear the timeout value More... | |
![]() | |
osockstream (sockstreambuf *ssb) throw () | |
constructor More... | |
virtual | ~osockstream () throw () |
destructor | |
Additional Inherited Members | |
![]() | |
iosocks () throw () | |
empty default constructor More... | |
Network (IPv4) controller class.
This is the base class for network (IP version 4) communications streams.
psocksxx::nsockstream::nsockstream | ( | sockstreambuf::socket_type_t | type, |
sockstreambuf::socket_protocol_t | proto | ||
) | |||
throw | ( | sockexception | |
) |
constructor
type | socket communications type |
proto | socket communications protocol |
psocksxx::sockexception | socket exception |
Open a network (IPv4) communications stream with the passed in type and protocol.
psocksxx::nsockstream::nsockstream | ( | sockstreambuf * | ssb | ) | |
throw | ( | ||||
) |
constructor
ssb | initialised socket stream buffer instance |
Initialise a network socket stream by using the passed in socket stream buffer, ssb
, as the associated sequence which is assumed to be initialised with the correct type and protocol. The class destructor will delete the psocksxx::sockstreambuf instance pointed by ssb
.
nsockstream * psocksxx::nsockstream::accept | ( | ) | ||
throw | ( | sockexception | ||
) |
accept a connection on a listening (passive) stream
psocksxx::sockexception | socket exception |
This method will accept an incoming connection on a listening stream and return a newly created stream instance that can be used to communicate with the accepted client connection. Note that the returned stream instance must be deleted by the caller.
void psocksxx::nsockstream::bind | ( | const nsockaddr * | saddr, |
bool | reuse_addr = false |
||
) | |||
throw | ( | sockexception | |
) |
bind the stream to a network address
saddr | address information to bind to |
reuse_addr | allow address to be re-used |
psocksxx::sockexception | socket exception |
This binds the network socket stream to the specified network address. If you want to try to bind to any socket that is not actively listening (e.g. TIME_WAIT) then set the reuse_addr
parameter to be true
.
void psocksxx::nsockstream::connect | ( | const nsockaddr * | saddr | ) | |
throw | ( | sockexception, | |||
socktimeoutexception | |||||
) |
connect to a network address
saddr | destination address information |
psocksxx::sockexception | socket exception |
psocksxx::socktimeoutexception | connection timeout exception |
Connect to a IPv4 communication end point making this stream ready for I/O.
void psocksxx::nsockstream::connect | ( | const char * | node, |
unsigned int | port | ||
) | |||
throw | ( | sockexception, | |
socktimeoutexception | |||
) |
connect to a network address
node | node (host name or IP) |
port | port number |
psocksxx::sockexception | socket exception |
psocksxx::socktimeoutexception | connection timeout exception |
Connect to a IPv4 communication end point making this stream ready for I/O.
void psocksxx::nsockstream::listen | ( | int | backlog = 0 | ) | |
throw | ( | sockexception | |||
) |
make this stream passive and ready to accept connections
backlog | maximum length of the queue for pending connections and if this value is 0 (default) then it assumes system default |
psocksxx::sockexception | socket exception |
Make this network stream passive and ready to accept connections. Before calling this method the stream must be bound to a network address using the bind() method.