What causes the ENOTCONN error?

前端 未结 5 1293
伪装坚强ぢ
伪装坚强ぢ 2021-02-01 05:20

I\'m currently maintaining some web server software and I need to perform a lot of I/O operations. The read(), write(), close() and

5条回答
  •  南旧
    南旧 (楼主)
    2021-02-01 06:07

    If you're sure you've connected properly in the first place, ENOTCONN is most likely to be caused by either the fd being closed on your end (perhaps in another thread?) while you're in the middle of a request, or by the connection dropping while you're in the middle of the request.

    In any case, it means that the socket is not connected. Go ahead and clean up that socket. It's dead. No problem calling close() or shutdown() on it.

提交回复
热议问题