I don't remember where I learned about restricting sockets to specific addresses, and I can't find any really descriptive information on it. Very frustrating... :(

Here is a relevant snippet from perlipc:

And here's a corresponding server to go along with it. We'll leave the address as INADDR_ANY so that the kernel can choose the appropriate interface on multihomed hosts. If you want sit on a particular interface (like the external side of a gateway or firewall machine), you should fill this in with your real address instead.
And here's something from Socket:
INADDR_ANY Note: does not return a number, but a packed string. Returns the 4-byte wildcard ip address which specifies any of the hosts ip addresses. (A particular machine can have more than one ip address, each address corresponding to a particular network interface. This wildcard address allows you to bind to all of them simultaneously.) Normally equivalent to inet_aton('0.0.0.0').
Let's say you have a machine that has two IP addresses: mymachine.example.com and foo.bar.baz.com. A server program which binds to the address mymachine.example.com will only accept connections made to mymachine.example.com. A program which binds to foo.bar.baz.com will only accept connections to foo.bar.baz.com, and a program that binds to localhost will only accept connections to localhost (which must, of course, also be from localhost).

On the other hand, a server program which binds to INADDR_ANY will accept connections made to any address that happens to resolve to the machine in question, including mymachine.example.com, foo.bar.baz.com, and localhost. That's usually what you want.


In reply to Re: Re: Re: local socket by chipmunk
in thread local socket by Punto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.