views:

39

answers:

3

Hi! I'm working on an app, in which server (windows based) will connect to the ipad application. Then data will be transfer from the server to the ipad app. I saw different apps like PDF Expert, Wifi HD, allows server apps to connect to the iphone app through IP address. I decided to use this approach. But I don't know how to implement this. How to make the iphone/ipad app to work as a web server like the above apps do and then transfer data to them from the server side. BTW I'll run this app on LAN. The app is not for apple's app store. So we can use private API's in it freely (If there is any for this purpose)

Anyone can help me in this regard?

Thanks

A: 

Try CocoaHTTPServer.

Sven
+1  A: 

First of all, your use of terms client and server seem incorrect (if I understood you correctly). The iPad application is not a server. It is a client. If you have a Windows application as the server, then all you would need to do is have the Windows application open a socket to listen for client connections. The iPad app would connect to the server on the port that the Windows server is listening. That's just the basics of how the client/server architecture works. There's more work that needs to be done for handling disconnects, multiple clients (if you are going to allow that), and other issues.

zooropa
A: 

I agree with zooropa, I think you want iPad to be the client, you could setup a HTTP server in windows (with a WAMP, or NIS, or whatever server you like), then in the iPad app, I would create a class to download files with NSURLConnection, check http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html for more information on how to implement a client and handle the requests.

Then when you want to download something, you use something like:

[HTTPClient downloadFile:@"http://lanserver/files/myFile.pdf" To:@"~/MyDocuments/"];

and the class would handle the request and store the file.

Leg10n