mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "汤国军" <towern...@gmail.com>
Subject Re: problem of using mina communicate with c++ socket
Date Wed, 05 Sep 2007 00:23:12 GMT
Sorry for late response, i'll try your suggestion.

2007/9/4, Lan Boon Ping <boonping81@gmail.com>:
>
> Hi,
>
> Be aware of little Endian(C++) and big Endian(Java), you should be able to
> use the ByteBuffer to decode the Struct Employee corrrectly. For instance,
>
> ByteBuffer message;
>
> message.order(ByteOrder.LITTLE_ENDIAN) ;
>
> byte[] name  = new byte[10];
> message.get( name);
> int id = message.getInt();
> int salary = message.getInt();
>
> Hope this help.
>
> Regards
> BP.
>
>
> On 9/4/07, 汤国军 <towerness@gmail.com> wrote:
> >
> > Hi, i am a newer of mina, and i'v got a problem. It like this:
> >
> > Before ,both of Our Client and server are using C++ socket. But now   we
> > want to  migrate the server by using mina.
> > We hava done some simple tests.
> > When I use c++ socket sending  a string , the simple mina server can
> > receive
> > it.
> >
> > But when sending a c++ struct,
> > struct Employee {
> > char name[10];
> > int id;
> > int salory;
> > };
> > the server can only read out "name",can not get the information of "id"
> > and
> > "salory".
> >
> > I implemented the method MessageReceive(session, msg). When I try to
> > type-cast msg to ByteBuffer, there throw out an exception.
> >
> > So i urgently want to know how can i do this?
> >
> > thank you and sorry for my poor english.
> >
> > --
> > Hope is a good thing, maybe the best of the things!
> >
>



-- 
Hope is a good thing, maybe the best of the things!
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message