Problema básico de ZeroMQ (0MQ) al volver a conectar o enlazar a sockets

I'm using ZeroMQ on Windows, using C#, and am confused by a very basic networking question. I set up simplistic sample programs, one to PUBlish messages, the others use a SUB socket to receive them (the SUBscriber programs). Works fine when both are on the same box. I used endpoint tcp:// As the next step, I put the SUBscriber program on a separate virtual machine (VM), to simulate using separate computers. I ran ipconfig to get it's IP address (on the guest os), The host os has several network interfaces, one of which is the VMware Network Adapter VMnet1, with IP On the host os, I ran the PUB program and connected the socket to, the IP address of the guest os. On the guest os, I ran the SUB program and connected the socket to the IP of the host os. Did not work. Then I changed the SUB program on the guest os to make it connect it to it's own IP address, ie that of the guest os - Now it works!

Question: Why? I'm confused. But in a way it sort of makes sense: if that socket is for a service that attends to various clients that dynamically come and go, it doesn't know the IP address of each client. Therefore what the heck do you specify as the IP address for the SUB socket?! So connecting it to it's own host IP address does solve that concern. But the ZeroMQ Guide doesn't say this anywhere! A related question is: if your host has multiple network interfaces, and each has it's own IP address, then if you connect your socket to some other host using the IP address of that other host - do you not need to specify which of those network interfaces you want to connect through? If so, how?

Incidentally, only one subscriber program seems to be able to connect at a time. The 2nd program to attempt to connect to it's SUB socket to the local IP address always gets a "Address is in use" error-message. I'm trying to make progress in small steps and learn this as I go. Thanks for any help or advice. James Hurst, JamesH at Designforge dot com

preguntado el 11 de septiembre de 13 a las 23:09

It might have something to do with how the VM is configured. If I understand you correctly, then a problem I had recently running a server application on a guest VM might be similar to yours. I changed the VM configuration to "Bridged" from "NAT", which I believe is the default and uses the VMNet adapters on the host. Solved my problem. -

I have the VM (VMware Workstation 9) set to "Host-only". I tested for connectivity by pinging the guest from the host, and visa versa. They do see each other, as far as the ICMP protocol is concerned. Perhaps I should re-test by connecting two cptrs on their own LAN hub. -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.