简体   繁体   English

Go RPC错误:读取主体gob:尝试解码为非指针

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

When I call RPC, this error will happen. 当我致电RPC时,会发生此错误。 While on the server side, I can get the call successfully. 在服务器端,我可以成功接到电话。

The error is defined at https://golang.org/src/encoding/gob/decoder.go As the error says, decoder need a pointer. 错误是在https://golang.org/src/encoding/gob/decoder.go上定义的。如错误所述,解码器需要一个指针。

The wrong rpc call is call(address, name, args, reply) . 错误的rpc调用是call(address, name, args, reply) Server can receive the call successfully while can not reply, the rpc call fails. 服务器可以成功接收呼叫而不能应答,则rpc呼叫失败。

The right way is call(address, name, args, &reply) 正确的方法是call(address, name, args, &reply)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM