I need to be able to publish data between multiple machines at remote locations.

I have been able to send data between two machines on a network in the same room. However, I have no idea how to begin with resolving IPs for machines on other networks that are miles away etc.

I would assume the application would need to LISTEN & PUBLISH in order to achieve this?

I have also googled this, and can only seem to find C# examples, and they seem to be for data between remote computers on the same network... What I need is to be able to find some guidance on sending data between me and someone who I previously had no knowledge of. I know this must be possible due to the fact that p-2-p chat clients exist, and that p-2-p file sharing exists.

I am not asking anyone here to write me the code, I would just really appreciate some material to work from.