QuestionQ33

VerifiedNetwork Programming

A socket object is typically created by which one of the following calls?

Explanation

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()).

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!