Scott Klement wrote:
You're right that INADDR_ANY allows connections from any adapter. (Which is what you want 95% of the time...)

Instead of INADDR_ANY, you simply set it to the IP address (binary -- not dotted) of the adapter you want to bind to.

For example:

bind_addr = inet_addr("127.0.0.1");
// fixme: do error checking here.
localAddr.sin_addr.s_addr = bind_addr;

It works. Thanks again, Scott.

One issue, though: we have a server shutdown utility that sends a shutdown command to the server through the loopback address. It appears that by opening the server specifically on the box's address, it no longer responds to the loopback address. I wasn't expecting that; is there a workaround, other than modifying the shutdown utility to allow a port to be specified there as well?

--
JHHL

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].