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--EXTENSIONS-- 6sockets 7--SKIPIF-- 8<?php 9if (getenv("SKIP_ONLINE_TESTS")) die("skip online test"); 10 11?> 12--FILE-- 13<?php 14$port = 80; 15$host = "yahoo.com"; 16$stringSocket = "send_socket_to_connected_socket"; 17$stringSocketLength = strlen($stringSocket); 18 19$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); 20$socketConn = socket_connect($socket, $host, $port); 21 22if(socket_send($socket, $stringSocket, $stringSocketLength, MSG_OOB)===$stringSocketLength){ 23 print("okey\n"); 24} 25 26if(!defined('MSG_EOR') || socket_send($socket, $stringSocket, $stringSocketLength, MSG_EOR)===$stringSocketLength){ 27 print("okey\n"); 28} 29 30if(!defined('MSG_EOF') || socket_send($socket, $stringSocket, $stringSocketLength, MSG_EOF)===$stringSocketLength){ 31 print("okey\n"); 32} 33 34if(socket_send($socket, $stringSocket, $stringSocketLength, MSG_DONTROUTE)===$stringSocketLength){ 35 print("okey\n"); 36} 37?> 38<?php 39socket_close($socket); 40unset($port); 41unset($host); 42unset($stringSocket); 43unset($stringSocketLength); 44unset($socket); 45unset($socketConn); 46?> 47--EXPECT-- 48okey 49okey 50okey 51okey 52