Even if you know the ip address of each device, you will still not be able to connect them over the internet. The example posted above will only work when the "server" device is connected to the internet through a router.
Mobile network providers block incoming connections.