Go RPC错误:读取body gob时尝试解码为非指针类型。

huangapple go评论69阅读模式
英文:

Go RPC Error: reading body gob: attempt to decode into a non-pointer

问题

当我调用RPC时,会出现这个错误。而在服务器端,我可以成功接收到调用。

英文:

When I call RPC, this error will happen.
While on the server side, I can get the call successfully.

答案1

得分: 9

错误定义在https://golang.org/src/encoding/gob/decoder.go中。
正如错误所说,解码器需要一个指针。

错误的RPC调用是call(address, name, args, reply)。服务器可以成功接收调用,但无法回复,因此RPC调用失败。

正确的方式是call(address, name, args, &reply)

英文:

The error is defined at https://golang.org/src/encoding/gob/decoder.go
As the error says, decoder need a pointer.

The wrong rpc call is call(address, name, args, reply). Server can receive the call successfully while can not reply, the rpc call fails.

The right way is call(address, name, args, &reply)

huangapple
  • 本文由 发表于 2015年2月24日 08:36:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/28686307.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定