Python Socket Module
Network communication — socket, connect, bind, listen, accept, send, recv. This category documents 12 Python socket module entries, and each page gives you the full syntax, the parameter list, the return value, and a runnable example. The entries include: socket.socket(), socket.bind(), socket.listen(), socket.accept(), socket.connect(), socket.send(), socket.sendall(), socket.recv(), socket.close(), socket.settimeout(), socket.gethostbyname(), socket.gethostname(). socket.socket() creates a socket for network communication. Default creates a TCP/IP socket. socket.bind() binds the socket to a local address (host, port) for receiving connections. socket.listen() enables the socket to accept connection requests (server mode). socket.accept() accepts a connection. Returns (client_socket, client_address) tuple. socket.connect() connects the socket to a remote address (client mode). Socket Module belongs to the System & OS group alongside OS Module, Sys Module, Platform Module, Getpass Module. You can also search across every category from the search page, browse the complete A–Z index, or try any example in the Python playground.