Socket: send() function returned 'Broken Pipe' error

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 01:33:52

问题


I am new to socket programming, I am trying to send some packets to server using the send() function in C++, but I am always getting a 'Broken pipe' error while sending packets to the server. Could you please help me for the below points?

  1. When the send() function returns the "Broken pipe" errors?
  2. What are the causes for "Broken pipe" errors in socket programming?
  3. What will be the solution for "Broken pipe" error from the send() function?

Note: I am using named socket to communicate between client and server.


回答1:


  1. When send() returns the "Broken pipe" errors

When you have written to a connection that has already been closed by the peer.

  1. What are the causes for "Broken pipe" errors in socket programming

Writing to a connection that has already been closed by the peer.

  1. What will be the solution for "Broken pipe" error from send() function.

Don't write to a connection that has already been closed by the peer.

It usually indicates that you have committed a prior application protocol error, so the peer didn't understand you and gave up.



来源:https://stackoverflow.com/questions/34448088/socket-send-function-returned-broken-pipe-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!