Writing to a closed, local TCP socket not failing

后端 未结 5 1132
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 21:10

I seem to be having a problem with my sockets. Below, you will see some code which forks a server and a client. The server opens a TCP socket, and the client connects to i

5条回答
  •  孤独总比滥情好
    2020-11-29 22:00

    I guess that you're running into the TCP stack detecting a failed send and attempting retransmission. Do subsequent calls to write() fail silently? In other words, try writing five times to the closed socket and see if you eventually get a SIGPIPE. And when you say the write 'succeeds', do you get a return result of 3?

提交回复
热议问题