1--TEST-- 2bool socket_shutdown ( resource $socket [, int $how = 2 ] ) ; 3--CREDITS-- 4marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br 5--EXTENSIONS-- 6sockets 7--SKIPIF-- 8<?php 9if (getenv("SKIP_ONLINE_TESTS")) die("skip online test"); 10 11if(substr(PHP_OS, 0, 3) == 'WIN' ) { 12 die('skip not for windows'); 13} 14?> 15--FILE-- 16<?php 17$host = "yahoo.com"; 18$port = 80; 19 20$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 21$socketConn = socket_connect($socket, $host, $port); 22var_dump(socket_shutdown($socket,0)); 23socket_close($socket); 24 25$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 26$socketConn = socket_connect($socket, $host, $port); 27var_dump(socket_shutdown($socket,1)); 28socket_close($socket); 29 30$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 31$socketConn = socket_connect($socket, $host, $port); 32var_dump(socket_shutdown($socket,2)); 33socket_close($socket); 34 35$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 36var_dump(socket_shutdown($socket,0)); 37 38$socketConn = socket_connect($socket, $host, $port); 39var_dump(socket_shutdown($socket,-1)); 40socket_close($socket); 41?> 42--CLEAN-- 43<?php 44unset($host); 45unset($port); 46unset($socket); 47unset($socketConn); 48?> 49--EXPECTF-- 50bool(true) 51bool(true) 52bool(true) 53 54Warning: socket_shutdown(): Unable to shutdown socket [%d]: %s in %s on line %d 55bool(false) 56 57Warning: socket_shutdown(): Unable to shutdown socket [%d]: Invalid argument in %s on line %d 58bool(false) 59