Reputation: 774
I'm new to socket programming and would like to ask some basic questions-
Upvotes: 1
Views: 1360
Reputation: 310884
- A socket is just one end point out of the millions of endpoints over the internet. True?
False. 'Endpoints over the Internet' is meaningless. A socket is an endpoint of a connection, which might have nothing to do with the Internet whatsoever. A socket can also be unconnected.
- A socket(on client side) uniquely tells which application I'm running and on which machine out of the billions of simultaneously running applications on millions of devices on the internet. True?
False. A socket is owned by a process, which in turn runs in a specific host. You're basically putting it back to front.
- Who makes socket, the programmer or are implicitly built by the underlying OS?
Neither. The application asks the operating system to create a socket.
- What does it mean to create a socket ? Both on the server and client side.
It means creating a socket. Unclear what you're asking here, or what kind of an answer you're expecting.
- Based on above question on what creating socket means, does creating a socket means establishing connection between the client and server,
No.
IF YES, who establishes the connection, the OS ?
See above.
IF NO, again then who establishes the connection, who connects those two sockets ?
The application asks the operating system to connect the socket to a target IP address and port.
- How does a single server with one particular socket handle multiple requests from clients simultaneously ?
The operating system creates a new socket for every accepted connection.
Upvotes: 2