mirror of
https://github.com/php/php-src.git
synced 2024-11-23 09:54:15 +08:00
ccda20b8d1
Allows to select an alternate TCP stack. For example with RACK, a fast loss detection relying on timestamp per packet. While it works system-wide, it can also apply in an individual socket level too. close GH-16842
34 lines
905 B
PHP
34 lines
905 B
PHP
--TEST--
|
|
Test if socket_set_option() works, option:TCP_FUNCTION_BLK
|
|
--EXTENSIONS--
|
|
sockets
|
|
--SKIPIF--
|
|
<?php
|
|
|
|
if (!defined("TCP_FUNCTION_BLK")) {
|
|
die('SKIP on platforms not supporting TCP_FUNCTION_BLK');
|
|
}
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
|
|
|
if (!$socket) {
|
|
die('Unable to create AF_INET socket [socket]');
|
|
}
|
|
socket_set_option( $socket, SOL_TCP, TCP_FUNCTION_BLK, "nochancetoexist");
|
|
// TCP/RACK and other alternate stacks are not present by default, at least `freebsd` is.
|
|
var_dump(socket_set_option( $socket, SOL_TCP, TCP_FUNCTION_BLK, "freebsd"));
|
|
var_dump(socket_get_option( $socket, SOL_TCP, TCP_FUNCTION_BLK));
|
|
socket_close($socket);
|
|
?>
|
|
--EXPECTF--
|
|
Warning: socket_set_option(): Unable to set socket option [2]: No such file or directory in %s on line %d
|
|
bool(true)
|
|
array(2) {
|
|
["function_set_name"]=>
|
|
string(7) "freebsd"
|
|
["pcbcnt"]=>
|
|
int(%d)
|
|
}
|