How to inject a “Broken pipe” error?

后端 未结 3 2002
野的像风
野的像风 2021-01-22 05:24

I am running test for a network program which uses TCP sockets. To verify a bug fix, I need to reproduce a \"Broken pipe\" error at the socket layer, but I don\'t know how. Any

3条回答
  •  伪装坚强ぢ
    2021-01-22 05:50

    A "Broken pipe" error message generally comes from the shell when it detects that a child it created has exited due to a SIGPIPE signal. So you can may be able to cause one manually by killing a child with a SIGPIPE (kill -PIPE %1 to kill the first background command).

    SIGPIPE is generated by the kernel and sent to any process that tries to write to a pipe or socket after the other end has been closed.

提交回复
热议问题