title: tcp message incomplete
body: <p>I'm using html5 websockets, dev.w3.org/html5/websockets/, and php socket functions, php.net/manual/en/ref.sockets.php. My problem is that messages sent from the client using websockets to the server are being truncated to a maximum of 1449 bytes. When I set net.ipv4.tcp_timestamps to 0, a couple extra bytes are received. I am using socket_recv. I did try to loop over socket_recv, but after the first call to socket_recv, the following warning emits:</p>
  
  <pre><code>Warning: socket_recv(): unable to read from socket [11]: Resource temporarily unavailable in [file] on line 94
  </code></pre>
  
  <p>Note:</p>
  
  <ul>
  <li>When I use socket_recv() with MSG_DONTWAIT, I get the above warning. e.g. socket_recv($socket, $data, 10024, MSG_DONTWAIT)</li>
  <li>If I just use 0, the system blocks. e.g. socket_recv($socket, $data, 10024, 0)</li>
  </ul>
  
  <p>So, why are messages sent being truncated?</p>
  
  <p>my sysctl.conf:</p>
  
  <pre><code>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
  </code></pre>