views:

25

answers:

3

Hi,

I was wondering how I can let my iPhone talk to a windows service, so for example when I press a button on the iPhone, a messagebox is shown on the windows machine.

Hope somebody has some good tutorials or sample code that will get me going...

Thanks in advance!

+1  A: 

You need to write some SERVER SIDE software on the Windows Box. It could be an ASP.NET page, a TCP/IP daemon, a PHP script, whatever you feel comfortable with writing on the server side. On that piece of software, do whatever you want: I.E. Show A Message Box.

On the iPhone, you will create a CLIENT to connect remotely to your SERVER SIDE software running on Windows, and trigger the desired action.

iPhone -> INTERNET -> Windows Box -> Your Script -> ACTION you want.

If you don't want to use ASP.NET, or PHP or any other Web Server program, then, as I mentioned, you can write a little TCP/IP or UDP/IP server daemon (using C#, C/C++, Python, Ruby, whatever you want) implementing your own simple protocol to trigger actions on the Windows machine. If the Windows machine does not have a FULL PUBLIC IP address, you need to have some sort of proxy, so the solution will be something like:

iPhone -> INTERNET -> PROXY.

Then your Windows program should query your proxy for new notifications:

Windows Box -> INTERNET -> PROXY -> ACTION you want

It's a little bit more complicated but you don't have a choice if you want the program to run on ANY Windows Box not having a public IP address.

Pablo Santa Cruz
Well that I had to create a server-client modal was clear, but I was wondering how I can communicate between the iPhone and the client. An ASP.Net page is a little bit stupid because that will force the user to install some kind of ISS or something. The plan is that the user installs a program on the PC, and the iPhone can communicate with the program.
CyberK
I see... I will add a little bit of that in the answer.
Pablo Santa Cruz
A: 

you're talking about a couple of different technologies working together here, so I dont think you're going to find an out of the box solution.

For one, you shouldnt have a windows service display a message box, you should have the service prompt a client application, that runs under a user account, as windows services are not really supposed to interact directly with the user.

To communicate between the iphone and the windows service, you need to have some transport in place. TCP will work, but do you need (the hassle of) raw TCP? you'll possibly have firewall issues with it too. email would be another way to go, and would act as a nice message queue between your iphone app, and your service. message queue software would be a third, though i dont know any that will work on iphone/windows.

jasper