if I have an iphone's IP address is there anyway I can communicate with it?
are there any services running by default on an iphone that would let 开发者_如何学JAVAanother ip address communicate with it if the iphone's ip is known?
Yes, technically, you can. There are a couple of issues though:
- Mobile IP addresses usually change
- When the phone is in sleep mode, its network interface is probably not reachable.
So I don't think you can rely on that for initiating a communication with the phone.
There aren't many options out of the box on a non jail-broken phone. However, you can write your own client application that runs on the phone. It accepts or initiates the remote connection.
And in that case, the protocol is entirely up to you.
If you jailbreak your phone, you can install the OpenSSH package and have SSH and SFTP access to your phone.
I don't know exactly what you want to do with your app, but you can consider create a thread detached from the main one (using gcd) and use it to send/receive informations from a server using JSON objects for example. Sure you can use sockets and write a client or something like that. I suggested a new thread because you can put it running forever (on a enterprise app, I don't know if Apple will approve a thread running on an App for AppStore). I had to develop an app with a consistent client/server relationship and it was the way I got it working.
精彩评论