Hi
I am writing a client-server program using apache MINA and protocol
buffers. I am trying to read data from client and sending it to server
and server has to read it and display it to console. But I am not
getting how to encode and decode using protocol buffers.Please anyone
help me. Here is my example.




Client Side:

SettingInformation.proto file

option java_outer_classname = "SettingInformation";

message MyClient{
   required int32 uid = 1;
   required int32 marks = 2;
}


public void sessionOpened(IoSession session)
{
        MyClient.Builder Info = MyClient.newBuilder();
        Info.setUid(12345);
        Info.setMarks(100);
        Info.build();
        session.write(Info);
}


Server Side:

GettingInformation.proto file

option java_outer_classname = "GettingInformation";

message MyServer{
        required int32 uid = 1;
        required int32 marks = 2;
}



public void messageReceived(IoSession session, Object message) {

        MyServer Info = (MyServer)message;
        System.out.println(Info.getUid());
        System.out.println(Info.getMarks());

}


i am getting this error
WARNING: EXCEPTION :
java.lang.ClassCastException: java.lang.String cannot be cast to
minaserver.GettingInformation$MyServer

Thanks in advance for your comments.

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

Reply via email to