| < Day Day Up > |
|
Packets
communication and, 4
headers, 7–12
processing in network stack, 13–15
Parameter checking, 152–153
Path MTU Discovery, 131
PDUs. (Protocol Data Units), 13–15
Peer sockets
closure, 106–108, 146
getpeername function, 60, 66, 123, 170–171
identifying peers, 123
Performance
advantages and disadvantages to select, 136–137
ensuring full-sized segments, 130–131
minimizing latency, 133–135
multiple sockets, 137
optimizing send/receive buffers, 131–133
reading/writing all available data, 135–136
separating control and data connections, 138
stack callbacks, 138–139
stack configuration, 141
stack selection, 140–141
UDP vs. TCP, 140
zero-copy buffer functions, 139
Perl
accept method, 223–224
bind method, 221–222
broadcast server/client code pattern, 374–376
CD-ROM companion software, 366
connect method, 224–225
creating and destroying sockets, 218–220
datagram (UDP) server/client code pattern, 369–371
datagram sockets, 228–229
event notification, 232–233
gethostbyaddress method, 231
gethostbyname method, 231
getservbyname method, 232
getservbyport method, 232
HTTP server code pattern, 377–382
interpreter/tools used, 216–217
listen method, 222–223
LWP::Simple module, 235
multicast server/client code pattern, 371–374
Net::SMTP module, 234–235
networking API summary, 217–218
networking API, 217, 234–235
origins and heritage, 216
references and resources, 236
SMTP client code pattern, 382–386
socket addresses, 220–221
socket options, 229–231
sockets I/O, 225–229
stream (TCP) server/client code pattern, 366–369
stream sockets, 225–228
TCP server and select method, 232–233
where to download tools, 217
Physical layer
communication via, 5–6
packet processing in network stack, 13–15
Port numbers
getservbyname function, 60, 75–77, 209, 232, 254
getservbyport function, 60, 77–78, 232
identifying services by, 125–127
overview of protocols, 5–6, 26
Perl methods for port information, 231
Python methods for port information, 209
Ruby methods for port information, 255
Tcl methods for port information, 271
Port scanner, 113–116
Precedence and TOS field, 94, 96–97
Programming, defensive
avoiding buffer overflow, 151–152
checking error returns, 152
checking input and output parameters, 152–153
declaring string arrays, 153
enabling compiler warnings, 155
initializing all variables, 154
minimizing protocol feedback, 153–154
Programming, sockets
paradigm, 26–27
sample client, 30–32
sample server, 27–30 see also Code patterns
Protocols
getprotobyname function, 123–125
identifying service ports and, 125–127
minimizing feedback, 153–154
PDUs, 13–15
port numbers, 5–6 see also specific protocols
Python
accept method, 202
bind method, 201
broadcast server/client code patterns, 352–354
CD-ROM companion software, 344
connect method, 202–203
creating and destroying sockets, 199–200
datagram (UDP) server/client code patterns, 347–349
datagram sockets, 204–205
event notification, 209–210
gethostbyaddress method, 208
gethostbyname method, 208
gethostname method, 208
getservbyname method, 209
HTTP server code patterns, 354–360
httplib module, 211–212
interpreter/tools used, 197
listen method, 201
multicast server/client code patterns, 349–352
networking API, 197, 210–213
origins and heritage, 196
PSF (Python Software Foundation), 196
references and resources, 213
SMTP client code patterns, 360–364
smtplib module, 211
socket addresses, 163–164
socket options, 205–208
Sockets API summary, 197–198
sockets I/O, 203–205
SocketServer module, 212–213
SocketServer module, 212–213
stream (TCP) server/client code patterns, 344–347
stream sockets, 203–204
TCP server and select method, 209–210
where to download tools, 197
| < Day Day Up > |
|