9 years, 2 months ago.

Socket::close implements only one situation of shutdown

Socket::close can call shutdown when it argument is true. However, shutdown is always called using SHUT_RDWR where both send and receive channels are closed (in fact, reset). When you do such kind of shutdown in a http connection, the other side (browser) may report this situation as an error and some data may be lost (if RST is sent together data). It would be better to shutdown using only SHUT_WR (closing only your side) or give the option to the user by argument.

My question:

How about adding a shutdown method, with support for SHUT_RD , SHUT_WR and SHUT_RDWR, like in any other BSD socket stack ? Or to change close() to support these three shutdown options.

See more: http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#closedown

Question relating to:

Be the first to answer this question.