Re:Et Tu, Procter and Gamble?
by dylan604 on Saturday April 10, 2021 @11:37AM
(#26762248)
Why does an app need to know the device's IP address? Why can't the OS just provide a method to communicate with the network. The OS handles all of the network communication with the app just providing the message and recipient?
[ Parent
| on HN ]
Because you can hit a server which can see your IP.
What does a server seeing the address have to do with the app seeing the address directly from the OS? The app knows the address it needs to talk to, so it preps the message and then calls an OS provided method to make that call. The OS method then returns the response. The app never needs to know the IP address of the device on which it is running.