Jump to content

Recommended Posts

If you bind to 0.0.0.0 then it will bind to all available IPv4 addresses. There is probably something similar for IPv6 but I do not know it off the top of my head.

 

To sort of address the question in a general sense though, I'm pretty sure you'd need one socket for each protocol. If you wanted to bind specific addresses rather than "all addresses" I'm pretty sure you'd need a socket for each address/port combo.

 

To sort of address the question in a general sense though, I'm pretty sure you'd need one socket for each protocol. If you wanted to bind specific addresses rather than "all addresses" I'm pretty sure you'd need a socket for each address/port combo.

That's spot-on. I was thinking of 0.0.0.0 but that's only IPv4. The underlying constants for binding (on Linux) AF_INET and AF_INET6 so that requires two calls to bind(). So actually no, it's definitely not possible to listen to both IPv4 and IPv6 - unless there's something which hides that kind of detail from you.

Edited by requinix

Thanks. I wonder if a pecl wrapper could be written to solve this issue, e.g. the wrapper provides something that looks and behaves like a socket but proxies multiple sockets, so you create and bind multiple sockets, and then the wrapper socket listens on them much like binding to 0.0.0.0:port would do.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.