I need to establish socket connection between window machine and iPads. So here window machine is a sever which can connect to one or many iPad. For window machine(server) code is already there.
So will it be any issue while connecting window machine with iPads using socket?? and what is the best way to do it ?
If you're asking for possible issues because one side is Win and the other iOS then you can be sure that's not gonna cause any issues.
Assuming you're talking about iOS TCP client - one good tutorial is here: iPhone Network Programming.
There is also Robbie Hanson's CocoaAsyncSocket: well written, easy to implement and comes with examples. Examples are OSX projects but can be quickly converted to iOS projects.
Related
Can someone please point me in the right direction to create a Mac/PC server app that runs in the background and connects to an iPad app over the local WiFi network?
No matter how I phrase a search on Google it just brings up various apps like Remote Mouse and whatnot and no tutorials or even a hint of where to start.
I just need to send simple commands from iPad to computer over local wifi. A point in the right direction and I can likely fill in the blanks.
Thank you.
Thomas
EDIT: I am using web languages for the iPad version that I will build as a native app using open source tools.
OK, then. It actually depends on what you really need. I made the assumption you need real-time and perhaps binary data transfer.
Your best bet is to write your server application using standard C or C++ so it compiles on both as simply as possible.
If you want to avoid all the burden of writing a protocol for service discovery or asking users to enter the ip address of your server you will use a mDNS implementation for your server and your iPhone app.
If I were you I would try bonjour: http://www.apple.com/support/bonjour/
on iPhone You could start here: http://developer.apple.com/library/mac/#documentation/Networking/Conceptual/NSNetServiceProgGuide/Articles/PublishingServices.html
Once you have your sockets you will have to implement a networking protocol between your server application and your iPhone app.
You will have to be careful about byte ordering and little subtle problems with latency, disconnections and other problems inherent to networking and WiFi.
In windows you will want to register your application as a service and in Mac OS X/UNIX you'll probably want to deamonize it.
Good luck!
I'm fairly novice in iPhone development, but trying to create what would seem a fairly simple application.
I want to have 1 program running on my phone/simulator that has a slider and a button, and another receiving program on the mac, such as Processing/Supercollider.
When the button is pressed i want a String such as "hello" to appear in the post window of the program on the mac, and when the slider is moved up/down for an integer, say between 0-99, to correspond with the movement on the phone. I'm assuming a WiFi connection would be essential for the sending of messages between devices.
Does anyone know how I might go about writing this - tutorials/code examples/links to get me started?
Cheers
cocoaasyncsocket is a great wrapper around CFSocket and CFStream, that makes networking much easier. Bonjour has great documentation at developer.apple.com
This should be done over a TCP connection which is established between your iPhone and the PC. For that to happen you need to write 2 pieces of software:
1) A client: to be installed on your iPhone
2) A server: to be installed on your PC
The server will listen to connections coming from the iPhone and once a connection is made you can send messages quite easily between the two.
This will give you a good grasp on the theory
Guide to socket programming in C
Once you have that then you can find tons of Obj-C TCP examples.
I'm porting Chicken of VNC Mac application into iphone application
I am having source code of Chicken of VNC Mac application which take vnc of any LAN connected mac. I have to do same with iphone app. So while debugging mac source code I am not able to figure out how that mac app establish an authenticated VNC connection?
My Current Progress
I have done some progress. Now i am able to connect any LAN connected MAC and can take VNC of it. But i think the way i am doing is wrong. Actually now i am calling unstoppable timer again & again for [conn startTalking] and making RFBConnection with server on every mseconds for uninterrupted connection. Is this is a right way ? But this arise a new problem i cannot scroll my vnc view because on every mseconds screen is refreshing with new RFBConnection. Can any one guide me ?
Its pretty strange that none of experts are sharing their views on
this thread
See section 7.1 (handshaking messages) and 7.2 (security types) of this page describing the RFB protocol.
This is a bad idea. Porting an existing complex application to a platform you do not know is a recipe for failure. Build some simple iPhone apps first, so you get a good feeling for how things are done on the platform.
Did you start by making a list of all Mac Cocoa code in there that is not supported on Cocoa Touch? And then build replacements for all of them?
I am trying to get a simple sockets program working on the Ipad.
To do this I am using the CFStreamCreatePairWithSocketToHost command.
It works fine on the simulator.
The problem is that it does not work on the iPad (I checked connectivity issues using the iPad's safari, and everything seems fine).
What I want to do is have the iPad open a connection to a PC. The reason I used CFStreamCreatePairWithSocketToHost was that I found a simple 10 line sample program which does this.
My questions:
1 - Does CFStreamCreatePairWithSocketToHost work on the iPad
2 - Can anyone direct me to a simple sample for ipad socket communications (I tried apple dev, and google. No sample that I found could be considered simple (less than 50 lines of code...))
Update:
Also tried sockets and NSHost, both withAddress and withName.
The results were the same: works perfectly inside the simulator, but does not work on the iPad.
I would suggest to use the socket-wrapper AsyncSocket. The download comes with a sample project.
edit
the most recent version can be found here
The low level APIs don't turn on the cellular radios. Use a very high level API to connect, then after the radios are turned on, disconnect if necessary, and (re)connect via BSD sockets.
An HTTP request to a server near the same destination IP would probably be sufficient.
Found the problem...
There was a "rouge" proxy problem in my organization, which was forwarding the saffari, but not my program (even thoughthe safati was not on an http port).
Solved, and thanks for your help.
So what I need help with is communicating with the iphone via a mac program. I don't want to do complicated stuff, I mainly just want to send the "screenshot" command, much like xcode does in the organizer window, however I want to be able to do my own things with it.
Check http://code.google.com/p/iphonedisk/
It uses MacFUSE. While it seems to have some problems it is a good start and I was using it a couple of years ago.
This site lists a way to connect to SSH through a USB connection:
http://oss.coresecurity.com/iphonedbg/usb_tunnel_doc.htm
It would be useful for a jailbroken iPhone.
As for other possibilities I haven't looked into, iphuc might be able to do get you just the screenshot capability without requiring you to be jailbroken. You will probably need to sniff them while running the organizer.