ZMQError: Cannot assign requested address
Asked Answered
D

2

10

I'm using zeromq to develop a dynamic application which operate like upnp protocol( autoconfiguration and auto-discovery of equipment on a living room). To do it so, i use zeromq to distribute messages, my problem is that when i create a socket and binding on a adress "169.254.1.0 through 169.254.254.255", I receive a error messages like this: ZMQError: Cannot assign requested address.

I've tried to figure out why by changing the address by local adress (127.0.0.1),and it's works !!. The problem is that i'm implementing autoip, it's means that i'm oblliged to use the adresse on range 169.254.1.0 through 169.254.254.255.

Thanks in advance for your help!

Darbies answered 7/12, 2012 at 8:23 Comment(0)
B
4

After you bring the interface up, you need to get its IP address and then bind on that. Alternatively you may be able to bind on "*", meaning all interfaces.

Bravery answered 7/12, 2012 at 21:54 Comment(3)
I followed your advice, but I still get an error, when i do socket.connect("tcp://169.254.1.4:5554") it works, but by making socket.bind("tcp://169.254.1.3:5553"), I still get an error. which interface do you talking about ?, Is it wlan0, eth0, etc.... interface or ....,Darbies
I don't know interfaces you have on your system. You haven't told us anything about the OS, or other technology you're using. Did you try to bind on the "*" interface (after bringing it up)?Bravery
I forgot to tell you my OS, My platform is ubuntu 12.04 and I have the basic interfaces which are: wlan0, eth0, l0, and virbr0. I bring all of those interface up. And about the "*" interface, I've already test it and its works but I have to focus on the adresse on range 169.254.1.0 through 169.254.254.255.( It's part of my project).Darbies
P
9

I got this error, too... and I realized I had the wrong idea of who was connecting to whom in the PUB/SUB model.

This was working: Host A as the ZMQ PUB, and could easily connect with Host A as the ZMQ SUB.

Then I tried to set up Host B as the SUB, and have Host A "send" to that... and I kept getting this error. After all don't you need to tell the PUB where to send the data?

No! Host A as the PUB should still bind to IP_ANY (0.0.0.0); it is Host B as the SUB who has to be configured with the address of Host A.

Once I got that straight in my code (and in my head), I was up and running.

Partridgeberry answered 14/4, 2017 at 20:57 Comment(0)
B
4

After you bring the interface up, you need to get its IP address and then bind on that. Alternatively you may be able to bind on "*", meaning all interfaces.

Bravery answered 7/12, 2012 at 21:54 Comment(3)
I followed your advice, but I still get an error, when i do socket.connect("tcp://169.254.1.4:5554") it works, but by making socket.bind("tcp://169.254.1.3:5553"), I still get an error. which interface do you talking about ?, Is it wlan0, eth0, etc.... interface or ....,Darbies
I don't know interfaces you have on your system. You haven't told us anything about the OS, or other technology you're using. Did you try to bind on the "*" interface (after bringing it up)?Bravery
I forgot to tell you my OS, My platform is ubuntu 12.04 and I have the basic interfaces which are: wlan0, eth0, l0, and virbr0. I bring all of those interface up. And about the "*" interface, I've already test it and its works but I have to focus on the adresse on range 169.254.1.0 through 169.254.254.255.( It's part of my project).Darbies

© 2022 - 2024 — McMap. All rights reserved.