psocksxx  1.0.0
Public Member Functions | Protected Member Functions | List of all members
psocksxx::nsockaddr Class Reference

Socket address class for IPv4 addresses. More...

#include <nsockaddr.h>

Inheritance diagram for psocksxx::nsockaddr:
psocksxx::sockaddr

Public Member Functions

 nsockaddr (const char *node, unsigned short port) throw ( sockexception )
 constructor More...
 
 nsockaddr (unsigned short port) throw ()
 constructor More...
 
 nsockaddr (const char *node, const char *service) throw ( sockexception )
 constructor More...
 
socklen_t size () const throw ()
 get POSIX socket address size More...
 
::sockaddrpsockaddr () const throw ()
 get a POSIX socket address structure More...
 
- Public Member Functions inherited from psocksxx::sockaddr
virtual ~sockaddr ()
 destructor
 

Protected Member Functions

in_addr_t resolve_node (const char *node) throw ( sockexception )
 convert a node name to a IPv4 address More...
 

Additional Inherited Members

- Public Types inherited from psocksxx::sockaddr
enum  address_t { af_unspec = AF_UNSPEC, af_local = AF_LOCAL, af_inet = AF_INET }
 

Detailed Description

Socket address class for IPv4 addresses.

This class holds the socket addressing structure for IPv4 socket communications.

Constructor & Destructor Documentation

psocksxx::nsockaddr::nsockaddr ( const char *  node,
unsigned short  port 
)
throw (sockexception
)

constructor

Parameters
nodenode (host name or IP)
portport number
Exceptions
psocksxx::sockexceptionsocket exception

Create a IPv4 socket address instance with the give node and port information.

psocksxx::nsockaddr::nsockaddr ( unsigned short  port)
throw (
)

constructor

Parameters
portport number

Create a IPv4 socket address instance with the given port and the node (host/IP) will be any available interface on the host computer.

psocksxx::nsockaddr::nsockaddr ( const char *  node,
const char *  service 
)
throw (sockexception
)

constructor

Parameters
nodenode (host name or IP)
serviceport number of the service name (e.g. "http")
Exceptions
psocksxx::sockexceptionsocket exception

Create a IPv4 socket address instance with the give node and service information.

Member Function Documentation

sockaddr * psocksxx::nsockaddr::psockaddr ( ) const
throw (
)
virtual

get a POSIX socket address structure

Returns
POSIX socket address structure

Helper function to get a pointer to the POSIX socket address structure relating to this socket address instance.

Implements psocksxx::sockaddr.

in_addr_t psocksxx::nsockaddr::resolve_node ( const char *  node)
throw (sockexception
)
protected

convert a node name to a IPv4 address

Parameters
nodenode (host name or IP)
Exceptions
psocksxx::sockexceptionsocket exception
Returns
IPv4 address in network byte order

Helper function to convert a node name into a IPv4 network address.

socklen_t psocksxx::nsockaddr::size ( ) const
throw (
)
virtual

get POSIX socket address size

Returns
POSIX address size

Helper function to get the size of the related POSIX socket address.

Implements psocksxx::sockaddr.