I am testing the 0MQ library, but my problem may be an IPC general one (or not). The test is very basic, a server binds to a socket, a client connects to it and sends a request. The server replies. When the client receives the response, it ends.
If I launch the server in a console in background, and then the client in the same console, it works. If I launch the client in a different console (same user), it fails, either the server does not receive the request, or the client does not receive the response, I don't know.
The same applies if I use a named pipe (ipc), or a socket.
The same applies if I test the C code or the Python code.
I checked the firewall, but it could be an issue only for the socket trial :
# iptables -L -n
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT udp -- 127.0.0.0/24 0.0.0.0/0 udp dpts:80:65535
ACCEPT tcp -- 127.0.0.0/24 0.0.0.0/0 tcp dpts:80:65535
ACCEPT udp -- 127.0.0.0/24 0.0.0.0/0 udp dpt:80
ACCEPT tcp -- 127.0.0.0/24 0.0.0.0/0 tcp dpt:80
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 reject-with tcp-reset
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmptype 0
ACCEPT udp -- 192.168.0.0/24 0.0.0.0/0 udp dpt:631
ACCEPT tcp -- 192.168.0.0/24 0.0.0.0/0 tcp dpt:631
Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT all -- 192.168.99.0/24 !192.168.0.0/24
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
The kernel looks alright for ipc :
# grep -i ipc /usr/src/linux/.config
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_IPC_NS=y
CONFIG_SYSVIPC_COMPAT=y
CONFIG_XFRM_IPCOMP=y
CONFIG_INET_IPCOMP=m
CONFIG_INET6_IPCOMP=y
# CONFIG_TIPC is not set
# CONFIG_SND_CMIPCI is not set
For information, the code I use is the flserver1 & flclient1 provided with 0MQ examples, and also in The Guide.
Elsewhere on the same PC in a home-made application, I make use of popen and then fork and pipes successfully.
What could be the problem origin please ?
EDIT 2013-06-26 18:22 CET
If I use tcp://127.0.0.1:5555 instead of tcp://localhost:5555, it works. I don't understand since in my /etc/hosts, localhost is declared :
# grep localhost /etc/hosts
127.0.0.1 JANUS localhost
#::1 localhost
But it is not annoying, so for me the socket issue is closed. Remains the ipc transport which still does not work on my PC (except when both server & client are runned in the same console).