国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

workman 如果要統(tǒng)計 收發(fā)的流量情況,改怎么統(tǒng)計?

tgzmos

workman 如果要統(tǒng)計 收發(fā)的流量情況,改怎么統(tǒng)計?

2170 1 1
1個回答

walkor 打賞

你可以加一個中間件,代碼類似

<?php
namespace app\middleware;

use Webman\MiddlewareInterface;
use Webman\Http\Response;
use Webman\Http\Request;

class Network implements MiddlewareInterface
{
    public function process(Request $request, callable $next) : Response
    {
        // http請求字節(jié)數(shù)
        echo strlen($request->rawBuffer())."\n";
        $response = $next($request);
        // http響應(yīng)字節(jié)數(shù)
        echo strlen($response)."\n";
        return $response;
    }
}

你可以把數(shù)據(jù)存儲在磁盤上或者某個存儲里

  • tgzmos 2021-01-25

    這是基于 http協(xié)議的,我的想法是 基于tcp協(xié)議,我是可以統(tǒng)計 每條tcp命令的 收到的數(shù)據(jù)長度,但是 實際tcp的通信中 消耗的流量 肯定比 收到的數(shù)據(jù)大的

年代過于久遠,無法發(fā)表回答
??