In Python's socket module, a socket object is instantiated with the constructor socket.socket(family, type[, proto]), where the first argument specifies the address/domain family (e.g., AF_INET) and the second specifies the socket type (e.g., SOCK_STREAM). This matches the invocation socket.socket(socket_domain, socket_type). The other options misrepresent the constructor's signature: a socket number alone is not valid, and a server address is not passed to the socket() constructor itself (it is instead used later with methods like connect() or bind()).
Community Discussion