How to communicate with a computer in a different Network

It doesn't matter in which network the PCs are for your program. You just need to make sure the packages are routed correctly, so that it is physically possible to access one pc from the other (via its ip address).

In your program you can just use a TCP connection with the TcpClient and TcpListener class to send your data back and forth. All information you need is the IP and Port of the PC to connect to.

A third-party server you mentioned is not necessarily needed if you have just two computers communicating in the same way all the time