I am relatively new to programming and am attempting to self learn socket programming. As per my understanding, a socket is needed at both endpoints if a process (say server process) needs to communicate with another process (say client process) over the network.
If my server and client processes are on the same machine, then why do I need sockets because the streams or datagrams are not going over the network? It's within the same machine. Can anybody please clarify the reason for this?
Then how do two processes on the same machine communicate without using sockets?
...
That's right, sockets are a way for two processes to communicate regardless of whether it's over the network or within the same machine. You could invent other mechanisms for communication within the same machine (and there are plenty), but why if sockets already serve that purpose perfectly fine?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With