Python Networking Programming

Python is a full- featured object-oriented programming language with a standard library that includes everything needed to rapidly build powerful network applications. Python is very simple and easy to learn, because of that the programming side to be as easy as possible so that you can learn as much as possible about the networking side. A network is a discrete collection of connected network devices. Python allows us to see the low level socket command s, just as if we were using C language, but also has modules that implement application layer protocols. Using some of the modules, we will be able accomplish much more, with less effort than we would in other programming languages. Python also has libraries that provide higher-level access to specific application-level network protocols, such as TCP, FTP, HTTP, and so on. The following lessons will focus on writing programs for networks that use the Internet protocol suite.


A network protocol defines rules and conventions for communication between network devices. Modern protocols for computer networking all generally use packet switching techniques to send and receive messages in the form of packets - messages subdivided into pieces that are collected and re-assembled at their destination. Network protocols must be confirmed and installed by the sender and receiver to ensure network/data communication and apply to software and hardware nodes that communicate on a network. In the standard model known as OSI (Open Systems Interconnection) , there are one or more protocols at each layer in the sender and receiver that both ends recognize and observe. The Internet Protocol family contains a set of related and among the most widely used network protocols. Beside Internet Protocol (IP) itself, higher-level protocols like TCP, UDP, HTTP, and FTP all integrate with IP to provide additional capabilities. Similarly, lower-level Internet Protocols like ARP and ICMP also co-exist with IP.


A socket is just a logical endpoint for communication. Its a virtual thing, and it does not mean any hardware. They exist on the transport layer. It is uniquely identified by an IP address , a port number, and a communications protocol. You can send and receive things on a socket, you can bind and listen to a socket. The client and the server must agree on a protocol, that is, they must agree on the language of the information transferred back and forth through the socket. It provides an interface for applications to utilize a system resource in a way that allows the operating system to mediate and organize the use of a limited resource by any number of applications.


TCP/IP stands for Transmission Control Protocol/Internet Protocol, which is a set of networking protocols used to interconnect network devices on the Internet. hese two protocols were developed in the early days of the Internet by the U.S. military , and it has been widely adopted as a networking standard. Before TCP/IP , there was no way for computers to communicate easily and securely on public networks. TCP/IP implements layers of protocol stacks, and each layer provides a well-defined network services to the upper layer protocol. Transmission Control Protocol (TCP) defines how applications can create channels of communication across a network. It also responsible how a message is assembled into smaller packets before they are then transmitted to the sender and reassembled in the right order at the receiver address. Internet Protocol (IP) defines how to address and route each packet to make sure it reaches the right destination. Each gateway computer on the network checks this IP address to determine where to forward the message. TCP/IP protocols map to a four-layer conceptual model known as the DARPA model . Each layer of the TCP/IP has a particular function to perform and each layer is completely separate from the layer(s) next to it. The four layers of the DARPA model are: Application Layer, Transport Layer, Internet Layer, and Network Access Layer.