In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
The address family of sockets (AF, Address Family) is divided into two types, one is file-based AF_UNIX, the other is network-based AF_INET,; sockets, there are two types of sockets, connection-oriented socket SOCK_STREAM and connectionless socket SOCK_DGRAM.
There are 3 modules commonly used in UDP:
(1) socket ([family [, type [proto]])
(2) sendto (string,address)
(3) recvfrom (bufsize [, flags]) receives and sends UDP data and receives data,address.
There are 6 modules commonly used in TCP:
(1) when a connect (address) client connects to a TCP server, the address address must be a two-element tuple in the format (host,port)
(2) send (bytes [, flags])
(3) recv (bufsize [, flags]) receives and sends TCP data and receives data.
(4) bind (address)
(5) listen (backlog) backlog specifies the maximum number of clients allowed to connect to the server. Its value is at least 1. When connection requests are received, they need to be queued, and if the queue is full, the request is rejected.
(6) when accept () calls the accept method, socket enters the "waiting" state. When the client requests a connection, the method establishes the connection and returns to the server. The accept method returns a tuple of two elements (connection,address). The first element, connection, is the new socket object through which the server must communicate with the customer; the second element, address, is the customer's Internet address.
The flow of the TCP connection is shown in the following figure.
It is important to note that when socket transmits information, it can only be sent in byte format, while python3 defaults to unicode format. Therefore, python3 needs to encode str.encode () when sending str and decoding str.decode () when receiving str.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.