Python Network Programming (11)

Source: Internet
Author: User

(i) Client/server architecture
1. What is the client/server used for?
The client makes a request to the server, and the server receives the request to service the client.
Server has two forms, a software server pattern, such as (Web server), the client sends the request to the server, the server receives the request, provides the information on the webpage for its service.
Another is the hardware server form, such as (printer, USB stick), to provide services to the client.
Both the client and the server, more special such as (bank ATM, computer) to provide hardware services (input, output, spit money), and send a request to the software server.
2. How the server communicates with the client
The server first creates a communication endpoint and listens for requests. Each server should (only) one communication endpoint.

(ii) network programming based on Python
1. Sockets are network data structures for communication endpoint concepts. (Socket set up and wait indefinitely)

2. Socket three-form Af_unix Af_netlink Af_inte used most of the time Af_inte

3. For a connection socket, specify a socket type by using the TCP connection Word to find the host by IP. (Server sockets and host sockets)

4. No connection UDP and IP

Create a UDP socket connection code implementation to receive two host communications

TCP implements a connection between two hosts

The above code comes from Cao Deqing's network Programming Soket () module programming

Python Network Programming (11)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.