diff --git a/src/udp_engine.cpp b/src/udp_engine.cpp index 4803913d..7a6c82f5 100644 --- a/src/udp_engine.cpp +++ b/src/udp_engine.cpp @@ -101,6 +101,10 @@ void zmq::udp_engine_t::plug (io_thread_t* io_thread_, session_base_t *session_) io_object_t::plug (io_thread_); handle = add_fd (fd); + // Bind the socket to a device if applicable + if (!options.bound_device.empty ()) + bind_to_device (fd, options.bound_device); + if (send_enabled) { if (!options.raw_socket) { out_address = address->resolved.udp_addr->dest_addr (); @@ -123,10 +127,6 @@ void zmq::udp_engine_t::plug (io_thread_t* io_thread_, session_base_t *session_) errno_assert (rc == 0); #endif - // Bind the socket to a device if applicable - if (!options.bound_device.empty ()) - bind_to_device (fd, options.bound_device); - rc = bind (fd, address->resolved.udp_addr->bind_addr (), address->resolved.udp_addr->bind_addrlen ()); #ifdef ZMQ_HAVE_WINDOWS