0

I got a C-ZMQ client that receiving two random ports (from pyzmq server) and then connecting to them.

Usually, everything is working, but sometimes the 2nd connect fail with errno set to EINVAL. (Even when I switched between the connect calls the 2nd still failed).

The port number is fine and it looks like some kind of race condition in ZeroMQ.

Anyone know how can I solve this problem?

[EDIT]:

The server sends the ports in this structure "port1:port2" for example "1234:1235" the hexdump of the packet on the server is 31 32 33 34 3a 31 32 33 35 and on the client is 31 32 33 34 3a 31 32 33 35 01

and because the extra byte the 2nd connect fails...

Maybe this is some kind of compatibility bug between pyzmq and zmq I'm using zmq ver 2.2.0

Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
Jah
  • 1,019
  • 1
  • 11
  • 25

1 Answers1

0

It's not a race condition in zmq, and not a problem with zmq_connect. That extra 0x01 byte is presumably at fault. If you are passing that to zmq_connect, what result do you expect except EINVAL?

So where does that extra byte come from? Do you get it on all messages sent between two peers? What are you doing different in this program?

Since you haven't provided source code it's hard to offer any more detailed advice than this.

Pieter Hintjens
  • 6,599
  • 1
  • 24
  • 29
  • i got the byte only in this message and not allways. sometimes it appears amd sometimes it doesn't appear. – Jah Nov 21 '12 at 10:10