我正在使用html5 websockets,dev.w3.org/html5/websockets/和php套接字函数,php.net / manual / en / ref.sockets.php。我的问题是从客户端使用websockets发送到服务器的消息被截断为最大1449字节。当我将net.ipv4.tcp_timestamps设置为0时,会收到几个额外的字节。我正在使用socket_recv。我确实尝试遍历socket_recv,但在第一次调用socket_recv后,会发出以下警告:
Warning: socket_recv(): unable to read from socket [11]: Resource temporarily unavailable in [file] on line 94
注意:
那么,为什么发送的邮件会被截断?
我的sysctl.conf:
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
net.ipv4.tcp_syncookies = 1
net.core.somaxconn = 900
net.ipv4.tcp_fin_timeout = 20
net.core.netdev_max_backlog = 2500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.udp_rmem_min = 16384
net.ipv4.udp_wmem_min = 16384
net.ipv4.tcp_rmem = 8192 87380 16777216
net.ipv4.tcp_wmem = 8192 65536 16777216
net.ipv4.tcp_mem = 8388608 12582912 16777216
net.ipv4.udp_mem = 8388608 12582912 16777216
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
答案 0 :(得分:1)
嗯,事实证明我必须在每个socket_select()
之后再次为给定套接字调用socket_recv()
。