Protobuf非常适合处理对象数据在网络方面通讯,所以Beetle.NetPackage加入了对Protobuf的支持,提供支持的平台有android和windows phone 8.
- android
mClient =new NetClient("10.0.2.2", 9088, new ProtoPackage(), this); mClient.Connect(); Register.Builder builder = Register.newBuilder(); builder.setEMail("henryfan@msn.com"); builder.setUserName("henryfan"); mClient.Send(builder.build());
- wp8
mClient = new NetClient("192.168.0.104", 9088, new ProtoPakcage(), this); mClient.LittleEndian = false; mClient.Connect(); Register reg = new Register(); reg.UserName = "henryfan"; reg.EMail = "henryfan@msn.com"; mClient.Send(reg);
迟下会补充详细的使用例程.