Here is a relevant snippet from perlipc:
And here's something from Socket: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.
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).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').
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |