Which one of the following is true for the below given Python commands?
S = socket.socket()
s.listen(5)
a. The socket listens for 5 seconds
b. The socket listens for 5 milliseconds
c. The socket can listen upto 5 incoming connections before denying any more
d. The socket can listen upto 6 incoming connections before denying any more
Answers
Answer:
Socket programming is a way of connecting two nodes on a network to communicate with each other. One socket(node) listens on a particular port at an IP, while other socket reaches out to the other to form a connection. Server forms the listener socket while client reaches out to the server.
They are the real backbones behind web browsing. In simpler terms there is a server and a client.
Socket programming is started by importing the socket library and making a simple socket
Explanation:
Here we made a socket instance and passed it two parameters. The first parameter is AF_INET and the second one is SOCK_STREAM. AF_INET refers to the address family ipv4. The SOCK_STREAM means connection oriented TCP protocol.
Now we can connect to a server using this socket.