Reputation: 14671
I have heard that sockets are used for all sorts of streaming between applications to send and receive data.
I have always thought and even read from articles that aim to give a "general sense" that sockets are used to create connections over networks.
However recently I saw that sockets are also used for local streaming/connections between apps which are not over a network.
My question;
Upvotes: 0
Views: 146
Reputation: 541
If the applications are on the same machine then you can use the localhost or loopback address 127.0.0.1
as the IP address of the socket and any port number > 1024
in both applications and then they can communicate over this connection .
Upvotes: 3
Reputation: 319
Also, if you want to use the socket approach and on linux, AF_UNIX is better than inet socket as they avoid some level of inet specific tasks like routing/adding-removing ip and transport headers, etc
Upvotes: 0