Python Network programming

Source: Internet
Author: User

Socket:

A socket is also called a socket, and an application usually makes a request to the network through a "socket" or responds to a network request, making it possible to communicate between hosts or between processes on a computer.

Python provides two levels of access to network services:

  • The low-level network service supports the basic socket and provides the standard BSD Sockets API, which can access all the methods of the underlying operating system socket interface.
  • The high-level Network Service module, Socketserver, provides a server-centric class that simplifies the development of network servers.

Socket () function:

Python, use the socket () function to create a socket

Socket.socket (Family,type,protocol)

Parameters

  • Family: The socket family can make Af_unix or af_inet
  • Type: The socket type can be divided into either a connection-oriented or a non-connected SOCK_STREAMSOCK_DGRAM
  • Protocol: General does not fill the default is 0.

Socket Object Method:

Python Network programming

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: info-contact@alibabacloud.com 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.