Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

forrestxu

macrumors newbie
Original poster
May 31, 2008
16
0
Hi

I want to creat TCP/IP server in Iphone so that I can remotely control it by PC.

Is it possible?

Thanks,
Forrest
 

Cromulent

macrumors 604
Oct 2, 2006
6,816
1,101
The Land of Hope and Glory
Hi

I want to creat TCP/IP server in Iphone so that I can remotely control it by PC.

Is it possible?

Thanks,
Forrest

I think you probably need to understand what it is you want to do first. TCP stands for Transmission Control Protocol and just controls how data is sent between computers. IP just stands for Internet Protocol which controls data transfer over the internet.

Neither offers anything like remote control. You are probably thinking of something like VNC.
 

keehun

macrumors regular
Mar 17, 2008
110
0
Well, unless you have developer certificate, you won't be able to use any app you make on your actual iPhone.

1. If you did have the Developer Certificate, then you wouldn't be asking such a question

2. If someone was to make it, Apple would almost certainly never approve it for App Store.

keehun
 

forrestxu

macrumors newbie
Original poster
May 31, 2008
16
0
Hi Cromulent and keehun,

Thank you for your help.

I have created TCP/IP server in simulator. I can control the simulator by the other coumputer.

My question is why "Apple would almost certainly never approve it for App Store?"

Thanks,
Forrest
 

Cromulent

macrumors 604
Oct 2, 2006
6,816
1,101
The Land of Hope and Glory
I have created TCP/IP server in simulator. I can control the simulator by the other coumputer.

When you say control, what do you mean exactly? TCP/IP has absolutely nothing to do with controlling devices. It is a data transfer protocol that all other internet and most network based protocols are based on such as FTP, POP3, IMAP, NNTP, HTTP and so on.
 

firewood

macrumors G3
Jul 29, 2003
8,141
1,384
Silicon Valley
firewall?

Does the iPhone OS have a firewall that would block incoming TCP/IP connections? If not, then it might possibly be acceptable to use the SDK to build a server which stays completely within the app sandbox and only runs when it's in the foreground. But IANAL.
 

forrestxu

macrumors newbie
Original poster
May 31, 2008
16
0
When you say control, what do you mean exactly? TCP/IP has absolutely nothing to do with controlling devices. It is a data transfer protocol that all other internet and most network based protocols are based on such as FTP, POP3, IMAP, NNTP, HTTP and so on.

Hi Cromulent,

Thank you for your reply.

The protocols you mentioned (FTP, POP3, IMAP, NNTP, HTTP) are application layer protocol and based on TCP/IP. I used normal socket code to create TCP/IP server in simulator, it works fine in simulator. And it can be built in device setting.
My colleague will test it to see if it can work in iphone.

Cheers
Forrest
 

SwampThingTom

macrumors member
Jul 12, 2008
37
0
Fairfax, VA
If I understand what you are asking, you would like to have an App on the iPhone that opens up a server socket that a remote client can connect to and send commands to "control" the iPhone. Is that correct?

If so, you will have multiple problems.

1) Your phone doesn't have a static IP address. What's more, I believe the only way you can find an iPhone on a network is via Bonjour. Bonjour won't route across subnets so the phone you are trying to communicate with will have to be on the same subnet as the client. You *might* be able to use some sort of dynamic-IP routing service, like DynDNS, and have the App update its current IP address when it starts. But that process isn't instantaneous and phones are regularly switching networks so I don't think it's a practical solution.

2) Apps can't run in the background so the only time you'll be able to access it remotely is when the app is actively running. Although you haven't specified what you would like to be able to do remotely, it seems less useful to only be able to "control" the phone when the user is actively running your app.

3) The things you can control from your app will be very limited. You could have it dial a phone number, bring up a URL in Safari, open the Mail app, open the Maps app, and maybe send an SMS (not sure). If there are any other installed apps that have registered a URL, you can bring those up as well. But note that whenever any one of those happens, that app starts running and yours stops. So you could send one "command" but once it's done, the user would have to exit that app and start yours back up again to receive more "commands".

The bottom line is, for any useful definition of remote control that I can think of, you won't be able to do what I think you want. Of course, without knowing more about what you are trying to do, I can't be sure. If you can live with all of the above limitations, sure, you can "remotely control" an iPhone via TCP/IP.
 

forrestxu

macrumors newbie
Original poster
May 31, 2008
16
0
Hi SwampThingTom,

Thank you very much!
You really sovle my question. You understand correctly!

Regards,
Forrest

If I understand what you are asking, you would like to have an App on the iPhone that opens up a server socket that a remote client can connect to and send commands to "control" the iPhone. Is that correct?

If so, you will have multiple problems.

1) Your phone doesn't have a static IP address. What's more, I believe the only way you can find an iPhone on a network is via Bonjour. Bonjour won't route across subnets so the phone you are trying to communicate with will have to be on the same subnet as the client. You *might* be able to use some sort of dynamic-IP routing service, like DynDNS, and have the App update its current IP address when it starts. But that process isn't instantaneous and phones are regularly switching networks so I don't think it's a practical solution.

2) Apps can't run in the background so the only time you'll be able to access it remotely is when the app is actively running. Although you haven't specified what you would like to be able to do remotely, it seems less useful to only be able to "control" the phone when the user is actively running your app.

3) The things you can control from your app will be very limited. You could have it dial a phone number, bring up a URL in Safari, open the Mail app, open the Maps app, and maybe send an SMS (not sure). If there are any other installed apps that have registered a URL, you can bring those up as well. But note that whenever any one of those happens, that app starts running and yours stops. So you could send one "command" but once it's done, the user would have to exit that app and start yours back up again to receive more "commands".

The bottom line is, for any useful definition of remote control that I can think of, you won't be able to do what I think you want. Of course, without knowing more about what you are trying to do, I can't be sure. If you can live with all of the above limitations, sure, you can "remotely control" an iPhone via TCP/IP.
 

Cromulent

macrumors 604
Oct 2, 2006
6,816
1,101
The Land of Hope and Glory
The protocols you mentioned (FTP, POP3, IMAP, NNTP, HTTP) are application layer protocol and based on TCP/IP. I used normal socket code to create TCP/IP server in simulator, it works fine in simulator. And it can be built in device setting.
My colleague will test it to see if it can work in iphone.

Did you read my post? I stated the above protocols were built on top of TCP/IP.

Your use of the term TCP/IP server was confusing.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.