[zeromq-dev] re: puzzled with zmq_socket bind and connect

charleszhangjie at qq.com
Thu Nov 8 18:21:06 CET 2012

I do some expirement:
 the net interface eth0 has two ip and
 set a REQ zmq_socket : bind(tcp:// and then connet to (tcp://
 then run the program, it sends message to the destination (tcp:// successfully, 
 when I use tcpdump tool to trace the message, I find the traffic is still ->
 It seems that the bind operation does not work because the program also works if I do not bind a specific address and the traffic does not change.
 If I want to the traffic change to ->, and I don't like to modify the system route configuration, how to do it?


 ------------------ 原始邮件 ------------------
  发件人: "Stephen Lord"<Steve.Lord at quantum.com>;
 发送时间: 2012年11月8日(星期四) 晚上8:55
 收件人: "<ph at imatix.com>"<ph at imatix.com>; "ZeroMQ development list"<zeromq-dev at lists.zeromq.org>; 
 主题: Re: [zeromq-dev]re: puzzled with zmq_socket bind and connect



 I don't think he means that type of bind, I think this is about controlling the source IP address on a connection to force the traffic over a specific NIC. A zeromq bind is not the same thing as binding a source socket to a particular local IP address. I suspect this would take a socket option which could only be used before connect to implement it. For a host where the NICs are on different subnets this would could lead to cases where you cannot make a connection, but for the case where you have multiple NICs on the same subnet and are not using NIC bonding it could be useful for separating traffic.

  On Nov 8, 2012, at 6:31 AM, Pieter Hintjens <pieterh at gmail.com> wrote:

Yes. You can bind any socket to an interface.
 On Nov 8, 2012 8:46 PM, "猫" <charleszhangjie at qq.com> wrote:
  Can a REQ zmq_socket bind to a specific interface?
 we know a Ping program, an useful command on Unix, can bind a specific src adress and ping a remote host, using -I option. Can a zmq_socket do the same thing? I don't find it in zmq guide.
 ( As the Guide says, a REQ zmq_socket connects to a REP zmq_socket )




 ------------------ 原始邮件 ------------------
  发件人: "Pieter Hintjens"<ph at imatix.com>;
 发送时间: 2012年11月8日(星期四) 下午4:35
 收件人: "ZeroMQ development list"<zeromq-dev at lists.zeromq.org>; 
 主题: Re: [zeromq-dev] puzzled with zmq_socket bind and connect


You can bind to a specific interface (e.g. "tcp://eth0:5550") and connect to specific IP addresses.  

 On Wed, Nov 7, 2012 at 11:56 AM, 猫 <charleszhangjie at qq.com> wrote:
  I am a fresh programer of 0mq. Could you tell me how to comprehend this feature of 0mq:
It queues messages automatically when needed. It does this intelligently, pushing messages as close as possible to the receiver before queuing them.
 For example, I run a 0mq client on one linux machine with multi ip addresses configured using REQ-REP pattern. Different ip address referes to different route information. when zmq client connects to 0mq server on another machine, which ip adrress is binded to the client zmq_socket? Can I program to determine a specific ip so that I can trace the network package it sends.



 The information contained in this transmission may be confidential. Any disclosure, copying, or further distribution of confidential information is not permitted unless such privilege is explicitly granted in writing by Quantum. Quantum reserves the right to have electronic communications, including email and attachments, sent across its networks filtered through anti virus and spam software programs and retain such messages in order to comply with applicable data security and retention requirements. Quantum is not responsible for the proper and complete transmission of the substance of this communication or for any delay in its receipt.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20121109/87777d34/attachment.htm>

More information about the zeromq-dev mailing list