我正在使用套接字通过此连接将这两个服务器连接到这些
之间的数据传输该进程对于有限数量的字节工作正常,但对于更多数据,它只接收8192个字节。它在localhost上工作正常,但在实时服务器中它提出了问题
有任何想法请在这里分享
我正在使用以下代码
$ip="********"; //Set the TCP IP Address to connect too
$port="8088"; //Set the TCP PORT to connect too
$command="hi"; //Command to run
$req['path'] = $path;
$post = json_encode($req);
//Connect to Server
$socket = stream_socket_client("tls://{$ip}:{$port}", $errno, $errstr, 30);
if($socket) {
//Start SSL
// stream_set_timeout($socket, 2);
stream_set_blocking ($socket, true);
stream_socket_enable_crypto ($socket, true, STREAM_CRYPTO_METHOD_SSLv3_CLIENT);
stream_set_blocking ($socket, false);
// stream_set_read_buffer($socket, 0);
//Send a command
fwrite($socket, $post);
$buf = null;
//Receive response from server. Loop until the response is finished
while (!feof($socket)) {
$buf .= fread($socket, 229653);
}
// sleep(10);
//close connection
fclose($socket);
if($path=="get_activity_report")
{
echo "<pre>";
print_r(strlen($buf)); exit;
}
//echo our command response
return json_decode($buf);
}