Can't read from socket (hangs)

前端 未结 4 1562
深忆病人
深忆病人 2021-02-06 07:17

I am using PHP to connect to a local C++ socket server to keep state between a web app and a couple of daemons. I can send data to the socket server, but not receive from it; i

4条回答
  •  长发绾君心
    2021-02-06 07:49

    TCP sockets usually try to combine multiple small send calls into one packet to avoid sending too many packets (Nagle's algorithm). This may be the cause that you can't receive anything after the send() call. You will have to open the socket with TCP_NODELAY to avoid that.

提交回复
热议问题