cppnanomsg icon indicating copy to clipboard operation
cppnanomsg copied to clipboard

The socket shutdown always gives EINVAL

Open sroycode opened this issue 12 years ago • 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)

sroycode avatar Oct 19 '13 06:10 sroycode

nn_close() should not return EINVAL, ever. Seems like a bug. I'll look into this later on.

sustrik avatar Oct 19 '13 06:10 sustrik

Any status on this and the other issue opened, or is this repository no longer maintained?

KjellKod avatar Mar 08 '16 22:03 KjellKod

Best estimate, dead on the vine. You're free to fork and run with it.

mwpowellhtx avatar Mar 08 '16 22:03 mwpowellhtx

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()

kuncao avatar Nov 14 '16 02:11 kuncao

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

kuncao avatar Nov 14 '16 07:11 kuncao