Chapter 19. Sockets and Server-Side Network Protocol Modules
To
communicate with the Internet, programs use devices known as
sockets
. The Python library supports sockets
through module socket
, as well as wrapping them
into higher-level modules covered in Chapter 18. To
help you write server programs, the Python library also supplies
higher-level modules to use as frameworks for socket servers.
Standard and third-party Python modules and extensions also support
timed and asynchronous socket operations. This chapter covers
socket
, the server-side framework modules, and the
essentials of other, more advanced modules.
The modules covered in this chapter offer many conveniences compared
to C-level socket programming. However, in the end, the modules rely
on native socket functionality supplied by the underlying operating
system. While it is often possible to write effective network clients
by using just the modules covered in Chapter 18,
without needing to understand sockets, writing effective network
servers most often does require some understanding of sockets. Thus,
the lower-level module socket
is covered in this
chapter and not in Chapter 18, even though both
clients and servers use sockets.
However, I only cover the ways in which module
socket
lets your program access sockets; I do not
try to impart the detailed understanding of sockets, and of other
aspects of network behavior independent of Python, that you may need
to make use of socket
’s functionality. To understand socket ...
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.