Pardon the newbie question. I am getting started with gRPC, and hitting a basic issue where the client gets an error code for the RPC call:
Error code: 14 Err msg: Endpoint read failed
TL;DR Server starts fine. Netstat shows it is listening on the port. Client fails to connect to netcat on same address as well.
The service is very simple:
<snip>
syntax = "proto3";
service MySvc { // name edited
  rpc GetVersion(Version) returns (Version) {}
}
message Version {
  int32 version = 1;
}
</snip>
The compilation succeeds with g++ 4.8.5 and "-Wall". The server starts up fine and prints:
<snip>
I0606 16:17:24.415181976Â Â Â 4792 server_builder.cc:247]Â Â Â Â Â Synchronous server. Num CQs: 1, Min pollers: 1, Max Pollers: 2147483647, CQ timeout (msec): 1000
Server listening on
127.0.0.1:50051</snip>
The command 'netstat -tulpn | grep ...' shows that the server is listening:
tcp6Â Â Â Â Â Â 0Â Â Â Â Â 0
127.0.0.1:50051Â Â Â Â Â Â Â Â :::*Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â LISTENÂ Â Â Â Â 4792/./<service-name>
I also ran 'nc -l 127.0.0.1 50051' and executed the client binary. The netcat got nothing. So, the issue seems be on the client side.
Here is my client code:
<snip>
class MySvcClient {
public:
  MySvcClient(std::shared_ptr<Channel> channel)
       : stub_(MySvc::NewStub(channel)) {}
  int GetServerVersion(int version) {
     Version client_version, server_version;
     ClientContext ctx;
     client_version.set_version(version);
     Status status = stub_->GetVersion(&ctx, client_version, &server_version);
     cout << "Error code: " << status.error_code();
     cout << " Err msg: " << status.error_message() << endl;
     if (status.ok()) {
        cout << "Server version: " << server_version.version() << endl;
        return server_version.version();
     } else {
        cout << "Failed to get Server version: " << endl;
        return -1;
     }
  }
private:
  unique_ptr<MySvc::Stub> stub_;
};
int main(int argc, char** argv) {
  MySvcClient client(grpc::CreateChannel(
     "
127.0.0.1:50051", grpc::InsecureChannelCredentials()));
  int myversion = 2;
  int server_version = client.GetServerVersion(myversion);
  cout << "Server version: " << server_version << endl;
  return 0;
}
</snip>