Contents
in Detail
xxvii
59
SOCKETS: INTERNET DOMAINS
1197
59.1
Internet Domain Sockets ........................................................................................... 1197
59.2
Network Byte Order ................................................................................................ 1198
59.3
Data Representation ................................................................................................ 1199
59.4
Internet Socket Addresses ......................................................................................... 1202
59.5
Overview of Host and Service Conversion Functions.................................................... 1204
59.6
The
inet_pton()
and
inet_ntop()
Functions .................................................................. 1206
59.7
Client-Server Example (Datagram Sockets).................................................................. 1207
59.8
Domain Name System (DNS).................................................................................... 1209
59.9
The /etc/services File ............................................................................................. 1212
59.10 Protocol-Independent Host and Service Conversion...................................................... 1213
59.10.1
The
getaddrinfo()
Function.................................................................... 1213
59.10.2
Freeing
addrinfo
Lists:
freeaddrinfo()
..................................................... 1217
59.10.3
Diagnosing Errors:
gai_strerror()
........................................................... 1217
59.10.4
The
getnameinfo()
Function................................................................... 1218
59.11 Client-Server Example (Stream Sockets) ...................................................................... 1219
59.12 An Internet Domain Sockets Library ........................................................................... 1225
59.13 Obsolete APIs for Host and Service Conversions ......................................................... 1230
59.13.1
The
inet_aton()
and
inet_ntoa()
Functions .............................................. 1230
59.13.2
The
gethostbyname()
and
gethostbyaddr()
Functions .................................. 1231
59.13.3
The
getservbyname()
and
getservbyport()
Functions ................................... 1234
59.14 UNIX Versus Internet Domain Sockets ........................................................................ 1235
59.15 Further Information .................................................................................................. 1235
59.16 Summary................................................................................................................ 1236
59.17 Exercises ................................................................................................................ 1236
Chia sẻ với bạn bè của bạn: