183k views
5 votes
What function do you use to make a socket for connecting/binding?

a) connect()
b) create_socket()
c) socket()
d) bind()

1 Answer

4 votes

Final answer:

To create a socket, the correct function is 'c) socket()'. This function sets up a new communication endpoint; 'bind()' is used to attach it to a local port, and 'connect()' to link it with another socket.

Step-by-step explanation:

To create a socket for connecting or binding in network programming, the correct function to use is c) socket(). The socket() function is used to create a new socket, which is an endpoint for communication between two machines. After creating a socket with the socket() function, you would then typically use the bind() function to associate the socket with a specific port on the local machine and the connect() function to establish a connection to another socket.

User Stiefel
by
8.1k points