0

I am tasked to create a windows application that I can send commands to from an android phone. The application should be able to work over the internet. So I can not use static IP's.

What would be the best tech to use for this. Currently I am thinking of doing the following

Should I create a webservice that once the application is started on the client(windows pc) then it sends its IP to the webservice, and then let the android application send the command to the webservice which will then send it to the windows client.

Is there a way to send the message directly to the windows client without having a webservice in the middle ?

thanks in advance

LomE999
  • 119
  • 16

2 Answers2

0

Should I create a webservice that once the application is started on the client(windows pc) then it sends its IP to the webservice, and then let the android application send the command to the webservice which will then send it to the windows client.

Yes.

Is there a way to send the message directly to the windows client without having a webservice in the middle ?

"No". Actually there is, but then you need a fully operating web server in the middle instead. The PC client, hidden behind a NAT, has to be made discoverable to others via the Internet somehow. If that suits you, P2P is what you're looking for: Android P2P (direct-connection) over the Internet (behind NAT).

Community
  • 1
  • 1
0101100101
  • 5,786
  • 6
  • 31
  • 55
  • Could you give more information on this "No (actually there is, but then you need a fully operating web server in the middle instead)." . It feels wrong to send message to web service first then back to the windows service – noobieguy Aug 19 '14 at 15:04
  • @noobieguy done. You should check around the Internet about the topic. – 0101100101 Aug 19 '14 at 15:13
0

Usually using a web server in the middle running your web service would be the preferred way. You must remember that when you're surfing the web using your mobile Internet connection, there's a very high chance your mobile ISP is using a NAT to bind several mobile users to a single public IP address, so you can't run a web server on your Android phone when you're connected to the Internet through your mobile carrier.

However, there is a way to do what you're asking without running an intermediate web server, and that is by using your Windows machine as the server and using DDNS (Dynamic DNS):

1) Setup DDNS in your Windows machine - There are several free services (and many paid services) that will let you install a program on your computer that will report the PC's dynamic IP address, and you'll be given a domain name that will always point to your Windows PC. If you wish to install the program on multiple machines, you can try and implement your own DDNS service (however, this will require an intermediate web server...)

2) Add web server features to your Windows application - simply put, you need to add a listener to your application on any port you wish to use that will listen to requests and answer them. If you're behind a home router, don't forget to open the necessary port.

3) Have your Android app connect to the DDNS domain name and perform the necessary requests.

mittelmania
  • 3,393
  • 4
  • 23
  • 48