[EuroPython 2012] F Buynooghe - 5 JULY 2012 in "Track Ravioli"
Sockets are a fundamental abstraction operating systems provide to expose networking operations. Initially they look like a fairly straight forward interface but they hide a surprising amount of complexity. Many protocol libraries hide sockets away from the developer but it can still be useful to know the sockets themselves. Other times directly using sockets is just a better or simpler option. This talk will cover practical socket programming in python, concentrating on TCP and UDP over IP (v4 & v6) the basic APIs of address resolution and using sockets will be covered. Common patterns and pitfalls will be pointed out which should enable to you to write robust socket code with the help of tools like StringIO and memoryview. After the basics python’s higher level abstractions like create_connection(), .makefile() and the io module are covered, explaining when and how these can make life easier. Finally a quick look at how non-blocking sockets can be used and how libraries like asyncore/asynchat, twisted, eventlet and gevent all approach non-blocking I/O in their own way.