Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect to a computer without public IP?

I have a simple app idea in my mind and I need to know how to connect from an Android application (client) to a Windows application (Delphi, server).

There is no need to be specific about the platform, I am familiar with networks in Delphi using winsock or Indy and I'm sure I will be able to figure out the appropriate mechanism in Android.

What I need to know is how to connect to a server (computer), which doesn't have its own public IP and is not in the same network as the client (one can be behind a local router, while the other might be connecting to the internet through 3G, for instance). This should be possible, as many programs work like that (remote desktop programs, TeamViewer, for instance: one computer is assigned an ID and using this ID other computer can connect to it.) I will not have access to the routers behind which the app will be running, so port forwarding is not an option.

I have a working network app, but that only works in LAN, so I'm guessing somewhat another approach is needed.

Thanks for answers

like image 658
Martin Melka Avatar asked Feb 19 '23 10:02

Martin Melka


2 Answers

Many of the programs that work that way still use a server with a public IP. Each side of the client connections to the server to say "here I am". The public server can then shuffle data between the two clients.

That still leaves a lot of questions regarding the communication between the public server and each client - i.e. pull vs. push for taking data that was sent to the server and getting it back down to the second client.

You may want to read the specification for Copilot (originally named Project Aardvark). Joel Spolsky published the specification when the started the project. It talks about their use of a reflector service.

The Reflector
A Windows Service which we run on our servers, used to allow any helper to help any victim even when both of them are behind firewalls. Both helper and victim connect to the reflector. The reflector checks that they are authorized and relays messages between helper and victim until the paid-up time runs out

like image 53
Mark Elder Avatar answered Feb 27 '23 09:02

Mark Elder


you could put an intermediate server which they can both route for "nat traversal".

otherwise you will have to put port forwarding on one of those computer's local router to allow incoming connections to be forwarded to the computer.

like image 22
Paul M Avatar answered Feb 27 '23 07:02

Paul M