Loading...
Searching...
No Matches
psocksxx::nsockaddr Class Reference

Socket address class for IPv4 addresses. More...

`#include <nsockaddr.h>`

Inheritance diagram for psocksxx::nsockaddr:

## Public Member Functions

| nsockaddr (const char *node, unsigned short port) throw ( sockexception )
| constructor
| nsockaddr (unsigned short port) throw ()
| constructor
| nsockaddr (const char *node, const char *service) throw ( sockexception )
| constructor
socklen_t | size () const throw ()
| get POSIX socket address size
::sockaddr * | psockaddr () const throw ()
| get a POSIX socket address structure
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

## 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

## nsockaddr() [1/3]

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

constructor

Parameters

  node | node (host name or IP)
  port | port number

Exceptions

  psocksxx::sockexception | socket exception

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

## nsockaddr() [2/3]

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

constructor

Parameters

  port | port 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.

## nsockaddr() [3/3]

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

constructor

Parameters

  node | node (host name or IP)
  service | port number of the service name (e.g. "http")

Exceptions

  psocksxx::sockexception | socket exception

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

## Member Function Documentation

## psockaddr()

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.

## resolve_node()

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

protected

convert a node name to a IPv4 address

Parameters

  node | node (host name or IP)

Exceptions

  psocksxx::sockexception | socket exception

Returns
  IPv4 address in network byte order

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

## size()

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.