[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5. sockinetaddr Class

Class sockinetaddr is derived from sockAddr declared in <sockstream.h> and from sockaddr_in declared in <netinet/in.h>. Always use a sockinetaddr object for an address with inet domain of sockets. See section 2.4 Establishing connections.

In what follows,

sockinetaddr sina
Constructs a sockinetaddr object sina with default address INADDR_ANY and default port number 0.

sockinetaddr sina(adr, portno)
Constructs a sockinetaddr object sina setting inet address to adr and the port number to portno. portno defaults to 0.

sockinetaddr sina(adr, serv, proto)
Constructs a sockinetaddr object sina setting inet address to adr and the port number corresponding to the service serv and the protocol proto. The protocol defaults to "tcp".

sockinetaddr sina(thostname, portno)
Constructs a sockinetaddr object sina setting inet address to the address of thostname and the port number to portno. portno defaults to 0.

sockinetaddr sina(thostname, serv, proto)
Constructs a sockinetaddr object sina setting inet address to the address of thostname and the port number corresponding to the service serv and the protocol proto. The protocol defaults to "tcp".

void* a = sina
returns the address of the sockaddr_in part of sockinetaddr object sina as void*.

int sz = sina.size()
returns the sizeof sockaddr_in part of sockinetaddr object sina.

int af = sina.family()
returns sockinetbuf::af_inet if all is well.

int pn = sina.getport()
returns the port number of the sockinetaddr object sina in host byte order.

const char* hn = getthostname()
returns the host name of the sockinetaddr object sina.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Herbert Straub on June, 15 2005 using texi2html