Thursday, December 29, 2011

[android-developers] Re: Packing data onto socket stream ?

Use a byte buffer as Miguel suggested. Extract byte by byte (or long
by long).
You'll have to deal with the little endian / big endian problem
regardless of the language/stack you chose. If you have the latitude,
don't use binary...


On Dec 30, 2:36 pm, SL <ecp_...@my-rialto.com> wrote:
> > ....
> >    xxxaaaaThis is a greeting.
> >  where:
> >  xxx  - message type (3 bytes, text)
> > aaaa - integer, 4 bytes, length of text
> > 'This is a greeting.' - the actual text
>
> > ....
>
> > There's no reason to use the NDK for this,
>
> > The standard Java socket API can be used for this easily:
>
> >http://docs.oracle.com/javase/tutorial/networking/sockets/
>
> I am not sure, for example, how to retrieve the integer portion (ie 4
> bytes); any problem with Endian oddities ?
>
> Just thinking, can I use an object, serializable one ?
>
> Thanks.
>
> --
> Using Opera's revolutionary email client:http://www.opera.com/mail/

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate