Bing Li wrote:
> I have a Java based server. So iPad needs to communicate with it.
> Moreover, I hope a P2P model can be established between the server and
> multiple iPads. Therefore, I hope I could use TCP to design the protocol
> directly instead of using HTTP.

Since HTTP typically runs over TCP I assume your concern is not wanting
to implement an HTTP server in your app for the P2P functionality?

If this is the case, I will first point out that there are actively
maintained open source HTTP daemons that I found by Googling (e.g.
http://code.google.com/p/cocoahttpserver/); can't vouch for their
quality, but seem to be widely referenced and used.

It is worth pointing out, with respect to your previous post, that the
fact that your servers run Java or the fact that you think XML might be
a good file format are not relevant to your decision about lower level
network architecture.

> However, I have NOT got sufficient materials to program TCP on iPad.

Should you decide not to go with NSURLConnection, etc., I would think
you should be able to fall back to using NSStream and its siblings
before needing to drop all the way down into the CFNetwork layer (which,
as others have pointed out, will certainly do what you need without
resorting to BSD sockets) for everything.

The one subtle complication here is that NSStream does not currently
support remote connections on iOS without modification.  Fortunately,
Apple provides documentation on how to get around this with a minimal
amount of CFNetwork to setup the stream:

http://developer.apple.com/library/ios/#DOCUMENTATION/Cocoa/Conceptual/Streams/Articles/NetworkStreams.html
http://developer.apple.com/library/ios/#qa/qa1652/_index.html

This would then give you all the NSStream Objective-C goodness, which
comports with the principle of using the highest level constructs
available that meet all your needs.

(Personally, I would spend a modest amount of time seeing whether I
could use HTTP, thereby removing the network stream code entirely.  But
NSStream isn't too much of a burden if HTTP is unworkable for license,
performance, or other reasons.)

-- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
twitter.com/TechConrad
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to