Search notes:

Python standard library: socket

gethostname

import socket
print(socket.gethostname())
Compare with socket.getfqdn() and platform.node

connect and create_connection

create_connection() is a higher-level function than connect().
Compare with create_server()

create_server

create_server() is a convenience function which creates a TCP socket.
Compare with bind() and listen(), and with connect() and create_connection().

See also

The class socket.socket.
socket.makefile returns a file object associated with the socket.
standard library, socketserver
Using selectors to implement a simple echo server.

Index