What is a socket and how does it work?
Hello guys, I have a quick question, previously I wanted to know what a socket is and how it works. I read a bit about networking in general and then tried to understand how sockets work. So basically, from what I've understood:
1. A socket is just an endpoint that enables us to read data or write data (just like a file can be read from or written to.)
2. Now, in the TCP/IP model, a socket is created, we give it an IP and a Port number. Then TCP will just to its things, wrap all packets, ensure they are assembled in required order or retransmit lost packets etc.
3. The underneath layer will then deliver the packets by some way.
(Sockets doesn't do the communication themselves, instead the layers in the TCP/IP model does that, so socket is kind of just a label? Like ok this is the gate that is allowed to send data or receive data?)
Can someone confirm whether the things said above is correct please... feel free to add up to it if needed.
1. A socket is just an endpoint that enables us to read data or write data (just like a file can be read from or written to.)
2. Now, in the TCP/IP model, a socket is created, we give it an IP and a Port number. Then TCP will just to its things, wrap all packets, ensure they are assembled in required order or retransmit lost packets etc.
3. The underneath layer will then deliver the packets by some way.
(Sockets doesn't do the communication themselves, instead the layers in the TCP/IP model does that, so socket is kind of just a label? Like ok this is the gate that is allowed to send data or receive data?)
Can someone confirm whether the things said above is correct please... feel free to add up to it if needed.
