I just downloaded and installed zeromq-4.0.5 on a Unbutu Precise system (12.04). I compiled hello-world client ( , connect, 127.0.0.1) and server ( , bind) written in C. REQ REP
- I am starting the server.
- I am running a client.
- Every second, the client sends a message to the server and receives a response.
- I press Ctrl-C to stop the server.
- The client tries to send its next outgoing message and gets stuck in an endless epoll system call (as shown by strace).
- I am restarting the server.
- The call
zmq_recvin the client is still stuck, even when the new server is running for a minute. The only way to succeed for the client is to kill him (using Ctrl-C) and restart him.
Q1: Is this the expected behavior? I expected that after a few seconds the client should find out that the server is working again and it will automatically -reconnect.
Q2: What should I change in the sample code to fix this?
Q3: Am I using the wrong software version or is something broken in my system?
I disabled the firewall, sudo iptables -Sprints -P INPUT ACCEPT; -P FORWARD ACCEPT; -P OUTPUT ACCEPT.
strace -f ./hwclient , connect() 10 ( ZMQ_RECONNECT_IVL) , . strace -f ./hwserver , accept() . , ( , , , ).
ipc:// tcp:// .
zmq_send, , zmq_send. , , zmq_recv, zmq_recv , , , .
, . , , , TCP , - zmq_recv - , , , .