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 9 10if(substr(PHP_OS, 0, 3) != 'WIN' ) { 11 die('skip windows only test'); 12} 13?> 14--FILE-- 15<?php 16$host = "yahoo.com"; 17$port = 80; 18 19$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 20$socketConn = socket_connect($socket, $host, $port); 21var_dump(socket_shutdown($socket,0)); 22socket_close($socket); 23 24$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 25$socketConn = socket_connect($socket, $host, $port); 26var_dump(socket_shutdown($socket,1)); 27socket_close($socket); 28 29$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 30$socketConn = socket_connect($socket, $host, $port); 31var_dump(socket_shutdown($socket,2)); 32socket_close($socket); 33 34$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 35var_dump(socket_shutdown($socket,0)); 36 37$socketConn = socket_connect($socket, $host, $port); 38var_dump(socket_shutdown($socket,-1)); 39socket_close($socket); 40?> 41--CLEAN-- 42<?php 43unset($host); 44unset($port); 45unset($socket); 46unset($socketConn); 47?> 48--EXPECTF-- 49bool(true) 50bool(true) 51bool(true) 52 53Warning: socket_shutdown(): Unable to shutdown socket [%d]: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied in %s on line %d 54bool(false) 55 56Warning: socket_shutdown(): Unable to shutdown socket [%d]: An invalid argument was supplied in %s on line %d 57bool(false) 58