Saturday, December 7, 2019

Help in understanding Sockets and Connections as it relates to TCP and programming

I have a bit of experience in software development, but little in the world of Networking.

I know that some programming language provide facility called Sockets, that allows you to open connection (which can be seen as a pipe) to a remove host, and using that, write or read information from that remote host.

The bit of networking I know, I am aware of routing, and the fact that on the internet, before a message from host A reaches another host B, it would probably travel via multiple routers.

I also know that TCP is a protocol used as a transport protocol for communicating on the internet. Unlike UDP, it is connection oriented.

Now this is where I am having troubles visualizing/understanding things:

If a route from host A to host B actually spans multiple network equipment in its path (routers, switches etc), how then is it possible to establish a connection between host A and host B? Will the connection span across all these multiple equipments? (I mean at any point in time, would the intermediate equipements be aware of the connection that has been established through them that allows host A to talk to host B?)

Same question above also applies to sockets. When a socket is established with a remotes, are all the intermediate machine also aware and persisting this connection?

I can imagine things if I have host A directly connected to host B...but I cannot understand the setup when it is actually two hosts reachable via the internet.

Explanation that could help me understand these things better would be appreciated!



No comments:

Post a Comment