OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
About TSocketAddress

Using

The TSocketAddress class stores a Winsock socket address. Note that the TSocketAddress class does not store Internet (IP) addresses specifically. It stores generic socket addresses. The TINetSocketAddress class is used to store Internet addresses.

All addresses stored by the TSocketAddress class are in network byte ordering. While the address family field (sa_family) is stored in network byte ordering, these families are #defined in winsock.h to values which are already in network byte ordering. Thus, you can simply refer to them by their names (e.g. AF_INET) and not have to call htons() on them.

The TSocketAddress class can be thought of as a C++ version of the sockaddr class.

Note that the only typed data that the sockaddr holds is the sa_family field. The sa_data field is a raw array of bytes that can hold any address supported by Winsock. For example, the sa_data field can hold an Internet address in the first 6 bytes of sa_data and leave the other 8 bytes zeroed out. Other address formats, such as IPX/SPX addresses, can also fit within 14 bytes. There are a number of constructors for TSocketAddress. Among them are a copy constructor, an empty constructor, a constructor from a char*, and others.

Many OWLSock functions expect a TSocketAddress as a parameter. You can pass a TSocketAddress or a subclass of it as the parameter. Some functions may expect a TINetSocketAddress as a parameter instead of just a TSocketAddress.