Bing Li wrote:

I believe TCP can be used between Java and iOS. However, I worry that
particular serialization exists in CocoaAsyncSocket so that Java cannot
deserialize successfully. Do you think the issue exists?


No.  If there is an issue, it's almost certainly in your code.

First, I have used CocoaAsyncSocket to communicate with Java sockets, and had no problems. I have sent and received binary data, lines of text, JSON data, and XML data. It all worked fine.

Second, CocoaAsyncSocket doesn't have any "particular serialization". It's just a socket, and it works with bytes in NSData. There is no other serialization, other than the in-memory layout of multibyte data structures you pass to and from NSData. If you don't know exactly what the in-memory structure of the NSData bytes is, then you don't really know what you're sending or receiving.

If your Java code needs a particular serialization, then that's because your Java code is written a particular way. The CocoaAsyncSocket must serialize data the same way. If you change the Java code to produce or expect some other serialization format, then your CocoaAsyncSocket code must match it.

You will need to define the order of bytes in your protocol, by which I mean the order of bytes in the messages or streams exchanged between the two sides. If you don't define the order of bytes, then there is no clearly defined common ground between the two sides.

  -- GG

_______________________________________________

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