1--TEST-- 2int socket_send ( resource $socket , string $buf , int $len , int $flags ); 3--CREDITS-- 4marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br 5--SKIPIF-- 6<?php 7if (!extension_loaded('sockets')) { 8 die('SKIP sockets extension not available.'); 9} 10if(substr(PHP_OS, 0, 3) != 'WIN' ) { 11 die('skip windows only test'); 12} 13?> 14--FILE-- 15<?php 16$port = 80; 17$host = "yahoo.com"; 18$stringSocket = "send_socket_to_connected_socket"; 19$stringSocketLenght = strlen($stringSocket); 20 21$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 22$socketConn = socket_connect($socket, $host, $port); 23 24if(socket_send($socket, $stringSocket, $stringSocketLenght, MSG_OOB)===$stringSocketLenght){ 25 print("okey\n"); 26} 27 28if(socket_send($socket, $stringSocket, $stringSocketLenght, MSG_DONTROUTE)===$stringSocketLenght){ 29 print("okey\n"); 30} 31?> 32<?php 33socket_close($socket); 34unset($port); 35unset($host); 36unset($stringSocket); 37unset($stringSocketLenght); 38unset($socket); 39unset($socketConn); 40?> 41--EXPECTF-- 42okey 43okey 44