Get started Bring yourself up to speed with our introductory content.

Explore this ultimate socket programming guide for beginners

In this socket programming guide preview, learn how sockets work, the role of socket programming in enterprise networks and the ins and outs of socket programming in Python.

Sockets are an important part of networks, and socket programming with Python can help network professionals quickly develop and write servers for low-level network applications.

Network professionals can use Python socket programming to more easily implement clients and servers for Transmission Control Protocol (TCP) and User Datagram Protocol as well. Python also plays a major role in network traffic analysis, which author José Manuel Ortega wrote about in the first edition of his book, Mastering Python for Networking and Security. With the updated Python 3.7, Ortega wrote a revised version of his book, which covers both similar and new topics compared to the first edition.

Below is an excerpt from Chapter 3, "Socket Programming," from Mastering Python for Networking and Security Second Edition. In this chapter, Ortega provides a basic socket programming guide for newcomers and explores the basics of using Python for the socket module. This chapter assumes readers have some basic knowledge about TCP/IP and command execution in OSes.

With Ortega's focus on Python in this socket programming guide, he said the book overall showcases how Python 3.7 offers developers greater possibilities for interactions between clients and servers. However, the foundations of Python are maintained, Ortega said.

José Manuel OrtegaJosé Manuel Ortega

This socket programming guide was also a chapter in Mastering Python for Networking and Security's first edition. Yet, Ortega's rewritten content and new chapters are compatible with Python 3.7+ and focus on security and forensics tools with Python, as well as content about Tor networks.

Both the first and second editions of Ortega's books can act as starting points to learn how sockets work and the role Python can play in socket programming. This chapter answers common beginner questions, like the different types of sockets -- including low-level sockets -- the role of sockets in networks and possible use cases networking professionals may come across.

Mastering Python book coverClick here to learn more
about this book.

Explore Mastering Python for Networking and Security Second Edition

Click here to read Chapter 3, "Socket Programming."

Next Steps

Test your knowledge of socket programming in Python

Start your Cisco DevNet Associate training with this quiz

This was last published in March 2021

Dig Deeper on Network management software and network analytics