Re: com php-src: Add SO_REUSEPORT + SO_BROADCAST support via socket stream context option: NEWS UPGRADING ext/ftp/ftp.c main/network.c
main/php_network.h main/streams/xp_socket.c
| From: | Julien Pauli | Date: | Wed, 06 Aug 2014 13:13:46 +0000 |
| Subject: | Re: com php-src: Add SO_REUSEPORT + SO_BROADCAST support via socket stream context option: NEWS UPGRADING ext/ftp/ftp.c main/network.c main/php_network.h main/streams/xp_socket.c |
||
| References: | 1 2 3 4 5 6 7 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-79761@lists.php.net to get a copy of this message | ||
On Wed, Aug 6, 2014 at 3:07 PM, Daniel Lowrey <rdlowrey@php.net> wrote:
> Sorry about that -- I assumed that since this was a minor option (that
> should already exist) and not new functionality it was fine.
>
> The problem here is that stream_socket_server() binds and listens in the
> same step. It's currently impossible to assign pre-bind options to a stream
> socket server for this reason. The existing stream context option approach
> is well-worn, not a new thing and provides a hook to do things like this
> right now in a way that maintains BC.
>
Yes, because stream_socket_server() was designed to hide many of these low
level technical things from the end user.
I would say that if you need a BSD-socket-API-like-API with PHP, just use
ext/socket which is designed for that.
>
> You won't hurt my feelings if it needs to be reverted, though I see little
> difference between adding this now or adding this in 5.6.1.
>
Yes, I know ;-)
But our process is clear here, even if putting that in the actual 5.6
branch should not hurt, let's follow strictly our process for 5.6.0 please.
> I **do** need this functionality, though. It's not just a spurious
> addition. Right now I have to resort to all sorts of ridiculous
> pcntl_fork() hackery to reuse the same port number on the same address for
> non-blocking servers in multiple processes. Further, these socket options
> are available across all environments (except Solaris for SO_REUSEPORT) and
> appropriate #ifdefs are in place just in case. Windows is the only
> environment that does not benefit from SO_REUSEPORT as its sockets exhibit
> this feature by default.
>
> In my humble opinion the lack of this functionality is a bug. Had I
> realized other people saw it as a feature I would have submitted a
> full-blown bug report to go along with it.
>
I tend to agree with you there.
Julien.Pauli