Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - bind() to "127.0.0.x" (x > 1): (3 Items)
   
bind() to "127.0.0.x" (x > 1)  
Hi

I'm trying to bind a socket to "127.0.0.2" (port 10001), but failing with errno == EADDRNOTAVAIL, "Can't assign 
requested address"...

It obviously works with the normal default localhost 127.0.0.1, but seems to fail for any other 127.0.0.x address.

It's is my impression that it should work and it works on Windows. Am I missing a route?

Best Regards
Poul Christiansen
Re: bind() to "127.0.0.x" (x > 1)  
You're missing the address locally.  No interface has been assigned that address:

# ifconfig lo0 127.0.0.2

Or if you want both 127.0.0.[12]

# ifconfig lo0 alias 127.0.0.2
 
(or)

# ifconfig lo1 create
# ifconfig lo1 127.0.0.2

A straight 'ifconfig' will show all the interfaces with their addresses.

Regards,

-seanb

----- Original Message -----
From: Poul Christiansen [mailto:community-noreply@qnx.com]
Sent: Friday, September 16, 2011 04:59 AM
To: technology-networking <post88885@community.qnx.com>
Subject: bind() to "127.0.0.x" (x > 1)

Hi

I'm trying to bind a socket to "127.0.0.2" (port 10001), but failing with errno == EADDRNOTAVAIL, "Can't assign 
requested address"...

It obviously works with the normal default localhost 127.0.0.1, but seems to fail for any other 127.0.0.x address.

It's is my impression that it should work and it works on Windows. Am I missing a route?

Best Regards
Poul Christiansen



_______________________________________________

Technology
http://community.qnx.com/sf/go/post88885
Re: bind() to "127.0.0.x" (x > 1)  
Ahh, great, thanks.

I'll be creating new devices because I still need 127.0.0.1 (and .3 and .4).
I am trying to get some multicasting setup to work

Thanks for the quick answer.