Cant bind to 127.0.0.1

Hi,

I dont know if it is a QNX-related problem but I do not have an idea where it could come from.

I create a socket and then try to bind() it as server socket. That works well for the IP 0.0.0.0 but fails when I use the same port but IP 127.0.0.1.

What could be the reason for that? Server sockets should work on localhost too?

HansHans

HansHans,

What error are you getting when you try to do the bind?

I’m going to assume that if you do an ‘ifconfig’ command that have a 127.0.0.1 loop back adaptor (ie you’ve started io-net).

Tim

bind() returns an error 257 - and ifconfig tells me that there is an IP 127.0.0.1:

lo0: flags=8009<UP,LOOPBACK,MULTICAST> mtu 33212
capabilities=7<IP4CSUM,TCP4CSUM,UDP4CSUM>
enabled=0<>
inet 127.0.0.1 netmask 0xff000000

I also can ping that IP but not bind something to it…

HansHans,

Looking in errno.h I see that 257 says ‘socket not connected’.

So at this point you’d need to post your code to help diagnose the issue.

Tim