Benchmarking 127.0.0.1 (be patient)...apr_socket_recv

简介: Benchmarking 127.0.0.1 (be patient)...apr_socket_recv

当我用ab进行对php socket代码进行并发测试出现问题,经过排查是我直接对客户端进行发送消息,没有先读取客户端消息造成的。

 

$text = "hello world" . PHP_EOL;

fwrite($conn, $text);

fclose($conn);

修改为

//读取client发送的信息

$client_msg = fread($conn, 1024);

echo 'client_msg:' . $client_msg . PHP_EOL;


//发送消息给client

$text = "hello world" . PHP_EOL;

fwrite($conn, $text);

fclose($conn);

ok

目录
相关文章
|
人工智能
Timeout on reading data from socket
Timeout on reading data from socket
170 3
|
4月前
|
Python
7. 2023-11-20 12:29:32,542 [tornado.general :456 ][WARNING ][3052] Got events for closed stream Non
7. 2023-11-20 12:29:32,542 [tornado.general :456 ][WARNING ][3052] Got events for closed stream Non
|
Java 网络安全 Docker
curl: (56) Recv failure: Connection reset by peer
curl: (56) Recv failure: Connection reset by peer
992 0
|
网络协议 安全 Linux
如何修复 SSH Client_loop: send disconnect: Broken pipe Error
如何修复 SSH Client_loop: send disconnect: Broken pipe Error
3590 1
|
网络协议 Java
filebeat:Failed to publish events caused by: write tcp 5044: write: connection reset by peer
filebeat:Failed to publish events caused by: write tcp 5044: write: connection reset by peer
697 0
filebeat:Failed to publish events caused by: write tcp 5044: write: connection reset by peer
|
Java 应用服务中间件 测试技术
Tomcat异常——ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
Tomcat异常——ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
1050 0
Tomcat异常——ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
|
监控 网络协议 Unix
Socket的基本操作函数socket()、bind()、listen()、connect()、accept()、recv()、send()、select()、close()
Socket的基本操作函数socket()、bind()、listen()、connect()、accept()、recv()、send()、select()、close()
1560 0
Socket的基本操作函数socket()、bind()、listen()、connect()、accept()、recv()、send()、select()、close()