Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The connection mode of socket in python

2025-03-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces the relevant knowledge of "how to connect socket in python". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Server monitoring, that is, the server is waiting for others to connect.

2, the client request, tell the server specific requirements or want to achieve things.

3. Confirm the connection and wait for both the server and the client to confirm the connection.

Example

Class socket (_ socket.socket): "A subclass of _ socket.socket adding the makefile () method."_ _ slots__ = [" _ _ weakref__ "," _ io_refs "," _ closed "] def _ init__ (self, family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None): # family and type have default values, and the default is to establish TCP communication between servers. # AF_INET: communication between servers (ipv4) # AF_INET6: communication between servers (ipv6) # AF_UNIX: communication between Unix different processes # SOCK_STREAM: parameters for establishing TCP # SOCK_Dgram: parameters for establishing UDP _ socket.socket.__init__ (self, family, type, proto) Fileno) self._io_refs = 0 self._closed = False "how to connect socket in python" ends here Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report