[zeromq-dev] Problem in example "A simple client/server application "

Fred Mobach fred at mobach.nl
Sat Feb 27 20:55:18 CET 2010


On Saturday 27 February 2010 18:51:39 Martin Lucina wrote:
> Hi,
>
> fred at mobach.nl said:
> > That R[eset] seems strange, so I checked with netstat -anp which
> > revealed
> > tcp  0  0 127.0.0.2:5555  0.0.0.0:*   LISTEN  3180/server
> >
> > Well, that's not going to work. So I changed a line in server.c :
> >     /* Bind to the TCP transport and port 5555 on the 'lo'
> > interface */ rc = zmq_bind (s, "tcp://127.0.0.1:5555");
> > And that's it. Then it runs as intended. But no clue why.
>
> That's strange, looks like zmq_bind() resolved 'lo' to 127.0.0.2 for
> some reason. What does 'ifconfig lo' / 'ip addr' say on your system?

nnservans:~ # ifconfig lo
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:95892 errors:0 dropped:0 overruns:0 frame:0
          TX packets:95892 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:22431885 (21.3 Mb)  TX bytes:22431885 (21.3 Mb)
So a search in another direction took me to /etc/hosts :
127.0.0.1       ad.nl.doubleclick.net
127.0.0.2       nnservans.mobach.nl nnservans

No idea why openSUSE 11.1 bothers to enter these entries in my hosts 
file, but I'll try again after updating this file. Clue in sight. :-)

> > Just one question remains : were can I grab in the server
> > environment the IP address and portnumber of the sending client ?
>
> No way to do that at the moment, other than doing it at the app level
> (make up a client ID / use the IP address and stick it in the
> message).

OK, but that's (at least for me) not thrustworthy. Like SMTP telling me 
who they are. ;-)

You don't mind if I take a look at the sources to see whether it is 
doable for me ?
-- 
Fred Mobach - fred at mobach.nl - postmaster at mobach.nl
website : https://fred.mobach.nl
 .... In God we trust ....
 .. The rest we monitor ..



More information about the zeromq-dev mailing list