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

目录
相关文章
|
8月前
|
运维 Java 应用服务中间件
Unexpected EOF read on the socket问题研究及解决
Unexpected EOF read on the socket问题研究及解决
551 0
|
人工智能
Timeout on reading data from socket
Timeout on reading data from socket
165 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
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
694 0
filebeat:Failed to publish events caused by: write tcp 5044: write: connection reset by peer
Jmeter问题之:解决 Cannot send data to network connection
Jmeter问题之:解决 Cannot send data to network connection
274 0
Jmeter问题之:解决 Cannot send data to network connection
|
网络协议
OGG-01232 Receive TCP params error: TCP/IP error 104 (Connection reset by peer), endpoint:
源端: 2015-02-05 17:45:49 INFO OGG-01815 Virtual Memory Facilities for: COM anon alloc: mmap(MAP_ANON) anon free: munmap file alloc: mmap(MAP_SH...
3135 0
|
监控 网络协议 Unix
Socket的基本操作函数socket()、bind()、listen()、connect()、accept()、recv()、send()、select()、close()
Socket的基本操作函数socket()、bind()、listen()、connect()、accept()、recv()、send()、select()、close()
1536 0
Socket的基本操作函数socket()、bind()、listen()、connect()、accept()、recv()、send()、select()、close()