Skip to:
The tcp_listener sets the socket FD when it accepts a connection. The tcp_connector on the other hand does not, leaving the FD to be -1.
diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cppindex 7d36d01..82110fc 100644— a/src/tcp_connecter.cpp+++ b/src/tcp_connecter.cpp@@ -124,6 +125,9 @@ void zmq::tcp_connecter_t::out_event ()tune_tcp_socket (fd);tune_tcp_keepalives (fd, options.tcp_keepalive, options.tcp_keepalive_cnt, options.tcp_keepalive_idle, options.tcp_keepalive_intvl);
+ // remember our fd for ZMQ_SRCFD in messages+ socket->set_fd(fd);+// Create the engine object for this connection.stream_engine_t *engine = new (std::nothrow)stream_engine_t (fd, options, endpoint);
Debian GNU/Linux
The tcp_listener sets the socket FD when it accepts a connection. The tcp_connector on the other hand does not, leaving the FD to be -1.
diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp
index 7d36d01..82110fc 100644
— a/src/tcp_connecter.cpp
+++ b/src/tcp_connecter.cpp
@@ -124,6 +125,9 @@ void zmq::tcp_connecter_t::out_event ()
tune_tcp_socket (fd);
tune_tcp_keepalives (fd, options.tcp_keepalive, options.tcp_keepalive_cnt, options.tcp_keepalive_idle, options.tcp_keepalive_intvl);
+ // remember our fd for ZMQ_SRCFD in messages
+ socket->set_fd(fd);
+
// Create the engine object for this connection.
stream_engine_t *engine = new (std::nothrow)
stream_engine_t (fd, options, endpoint);