[zeromq-dev] bstarcli, Bad file descriptor returned, getsockopt

hhusp house hhusp at outlook.com
Tue Jun 23 09:03:58 CEST 2015

I built the czmq-stream-client.c and  czmq-stream-server.c and did an strace on the server.I got the same result (errno 9 returned by getsockopt).  (src/zsock.c:1524)Called by zsock_resolve (self=0x603da0)
The strace shows that first argument op getsockopt is not a valid socket. Should by 9 in this case.
20120 socket(PF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 920120 setsockopt(9, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 020120 bind(9, {sa_family=AF_INET, sin_port=htons(5555), sin_addr=inet_addr("")}, 16) = 020120 listen(9, 100)                    = 020120 getsockname(9, {sa_family=AF_INET, sin_port=htons(5555), sin_addr=inet_addr("")}, [16]) = 020120 write(6, "\1\0\0\0\0\0\0\0", 8)   = 820120 write(8, "\1\0\0\0\0\0\0\0", 8)   = 820120 getsockopt(888436816, SOL_SOCKET, SO_TYPE, 0x7fff68fa93d8, 0x7fff68fa93d4) = -1 EBADF (Bad file descriptor)
From: hhusp at outlook.com
To: zeromq-dev at lists.zeromq.org
Date: Mon, 22 Jun 2015 08:56:21 +0200
Subject: [zeromq-dev] bstarcli, Bad file descriptor returned, getsockopt

Platform: CentOSzeromq-4.1.2czmq-3.0.2

I built the bstarsrv2 and bstarcli from the C examples zguide tree(git clone --depth=1 git://github.com/imatix/zguide.git)
When I look at trace a noticed the error returned by getsockopt:
getsockopt(2300165744, SOL_SOCKET, SO_TYPE, 0x7fff9f74b3bc, 0x7fff9f74b3b8) = -1 EBADF (Bad file descriptor)
sock_type is -1
Call stack:(gdb) bt#0  zsock_resolve (self=0x604da0) at src/zsock.c:1525#1  0x00007ffff7b3afad in zstr_recv (source=<value optimized out>) at src/zstr.c:63#2  0x0000000000400b3f in main () at bstarcli.c:44

zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150623/dbc17d52/attachment.htm>

More information about the zeromq-dev mailing list