php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #73406 Update new addrinfo API to allow setting socket options.
Submitted: 2016-10-28 06:14 UTC Modified: -
From: email at davekok dot nl Assigned:
Status: Open Package: Sockets related
PHP Version: master-Git-2016-10-28 (Git) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
31 - 11 = ?
Subscribe to this entry?

 
 [2016-10-28 06:14 UTC] email at davekok dot nl
Description:
------------
The new socket_getaddrinfo is a great new additions [https://wiki.php.net/rfc/socket_getaddrinfo]. However it does not allow making setting socket options before bind or connect are called. As the creations of the socket and calling bind/connect are done in a single function.

Especially for bind this is annoying as you often want to make the socket reusable.

  socket_set_option($this->socket, SOL_SOCKET, SO_REUSEADDR, 1)

Any change socket options could be passed into socket_addrinfo_{bind,connect} as a second parameter? Something like an array containing arrays with three arguments to describe the socket option, which must be set after the socket is created but before connect or bind are called.



Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 17:01:30 2024 UTC