regarding the std.socket docs

Downs default_357-line at yahoo.de
Thu May 10 13:20:55 PDT 2007


The socket documentation for phobos claims that for connection-oriented sockets, it is recommended to call shutdown before calling close.
I followed this advice blindly.
Because of this, I have had literally weeks of work trying to figure out why my sockets randomly dropped data.
Then, in some far-away website, I found the following sniplet of information:

— Function: int shutdown (int socket, int how)
     The shutdown function shuts down the connection of socket socket. The argument how specifies what action to perform:
     0 Stop receiving data for this socket. If further data arrives, reject it.
     1 Stop trying to transmit data from this socket. Discard any data waiting to be sent. Stop looking for acknowledgement of data already sent; don't retransmit it if it is lost.

The important bit being "Discard any data waiting to be sent"
Naturally, I felt quite stupid at this discovery, and at having to remove all my elaborate work-arounds.
So could you _please_ add this piece of information to the std.socket docs?

Also, why is it recommended to call shutdown before close? I don't see the purpose.

  -- downs



More information about the Digitalmars-d mailing list