The socket shutdown always gives EINVAL
sroycode opened this issue · 5 comments
Hi:
I am trying to make a proof-of-concept RPC with nanomsg and google protobuf.
The shutdown always gives EINVAL, what am I doing wrong ?
Example:
https://github.com/sroycode/nanorpc/blob/master/EchoClient.cc
line no 50 (commented out)
nn_close() should not return EINVAL, ever. Seems like a bug. I'll look into this later on.
Any status on this and the other issue opened, or is this repository no longer maintained?
Best estimate, dead on the vine. You're free to fork and run with it.
Hi:
I am trying to make a proof-of-concept RPC with nanomsg and google protobuf.
The shutdown always gives EINVAL, what am I doing wrong ?
Example:
https://github.com/sroycode/nanorpc/blob/master/EchoClient.cc
line no 50 (commented out)
----I find reason
in file RpcChannel.cc
void nrpc::RpcChannel::Close()
{
if (sockid>0) {
//sock.shutdown (0);//this is commented by jack at 20161114
sock.shutdown (sockid);//this is added by jack at 20161114
sockid=0;
}
}
it is not the bug of nn_close()
in file RpcServer.cc change sock.shutdown (0) to sock.shutdown (sockid) such as following:
void nrpc::RpcServer::Close()
{
if (sockid>0) {
//sock.shutdown (0);//this is commented by jack at 20161114
sock.shutdown (sockid);//this is added by jack cat 20161115
sockid=0;
}
}
the error message "Invalid argument" disappeared after control+ c
messages with sock.shutdown (0):
^CExiting on ^C 2
terminate called after throwing an instance of 'nn::exception'
what(): Invalid argument
Aborted
messages with sock.shutdown (sockid)
^CExiting on ^C 2
NN EXCEPTION : Interrupted system call