The connection mode of socket in python
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!