protobuf 的东西,完全整不明白了!急啊!!!!!!!!!!

心像 2011-11-23 11:15:32

Dim rpcResponse As New GetPubKey.RpcResponse

rpcResponse = ProtoBuf.Serializer.DeserializeWithLengthPrefix(Of RpcResponse)(Stream, ProtoBuf.PrefixStyle.Base128, Stream.Length)


Console.WriteLine("收到了!" & rpcResponse.flag)//这里出错"未将对象引用设置到对象的实例。"

可是明明是有引用到实例了"Dim rpcResponse As New GetPubKey.RpcResponse"

谁能告诉我怎么操作protobuf,进行接口数据传递啊!!!!
...全文
220 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
心像 2011-11-23
  • 打赏
  • 举报
回复
如果我要向服务器发送,则还需要用 client.BeginSend进行发送?可我在接收时怎么知道我接收的数据大小呢?

我的远程服务器的协议格式:数据的前4个字节表示的是数据的长度,后面是proto的内容?

我该如何获取数据?
心像 2011-11-23
  • 打赏
  • 举报
回复
再问:rpcResponse = ProtoBuf.Serializer.DeserializeWithLengthPrefix(Of RpcResponse)(Stream, ProtoBuf.PrefixStyle.Base128, Stream.Length)这句是不是将Stream流,格式为RpcResponse的然后传给rpcResponse?


ProtoBuf.Serializer.SerializeWithLengthPrefix(Stream, MyReques, ProtoBuf.PrefixStyle.Base128)
是不是将MyReques,序列化为Stream?
liuyilin888 2011-11-23
  • 打赏
  • 举报
回复
增加:
if rpcResponse is not Nothing then
Console.WriteLine("收到了!" & rpcResponse.flag)
end if
阿非 2011-11-23
  • 打赏
  • 举报
回复
ProtoBuf.Serializer.DeserializeWithLengthPrefix(Of RpcResponse)(Stream, ProtoBuf.PrefixStyle.Base128, Stream.Length)

为 Nothing

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧