Skip to content
Tcl Source Code Artifact [bd2990cfdc]
Login

Artifact [bd2990cfdc]

Artifact bd2990cfdcb13027f221adab32ca01fa170a5382:

Ticket change [bd2990cfdc] - Ticket [2446662fffffffff|2446662fff] <i>chanIO.test failures on Win32 msys/mingw</i> status still Open with 4 other changes by davygrvy on 2009-01-08 15:55:36.
D 2009-01-08T15:55:36
J icomment >\s(2)\sPerusing\sthe\s[fconfigure\s-blocking]\sbit\sto\sdecide\sthe\sbehavior\sjust\n>\slike\sfor\spipes\s(which\sdoes\smake\ssense\sex\snihilo)\swould\spose\sa\scompatibility\n>\sissue\swith\ssockets\s(imagine\sapps\stalking\sto\srude\sservers\sthat\sdon't\sreact\n>\sto\sa\sFIN\s...\sthey\swould\sblock\sforever\sin\s[close])\n\nNot\sexactly..\s\sReviewing\sthe\sclose\schart\s@\shttp://msdn.microsoft.com/en-us/library/ms738547(VS.85).aspx\sand\shttp://msdn.microsoft.com/en-us/library/ms737582(VS.85).aspx\sI\ssee\sthe\sfollowing\sbehavior\sas\spossible:\n\n\s\s\s\sclient\s\s\s\s\s|\s\s\s\s\sserver\n\n(1)close\s$s\sw\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s(2)if\s{[eof\s$s]}\s{\sfinishSending\s$s;\sfconfigure\s-blocking\s1;\sclose\s$s\s}\n(3)if\s{[eof\s$s]}\s{fconfigure\s-blocking\s1;\sclose\s$s}\n\nAs\sthe\sclient\swas\sthe\sinitiator,\sTIME_WAIT\sdoesn't\shave\sto\scollect\son\sthe\sclient\sas\sthe\sEOF\sindicator\sdescribes\sthe\sclosure\sas\scomplete.\s\sJust\slet\sshutdown\sreturn\simmediately\sand\scollect\sthe\sACK\slater\swith\ssetsockopt(SO_DONTLINGER)\sprior\sto\sclosesocket().\s\sWhich\shappens\sto\sbe\sthe\sdefault\sanyways.\n\nNow\sif\syou\swould\sprefer\san\sabortive\sclose:\n\n\s\s\s\sclient\s\s\s\s\s|\s\s\s\s\sserver\n\n(1)fconfigure\s-blocking\s0;\sclose\s$s\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s(2)\sdon't\scare\n\nSame\sas\sabove,\sbut\ssetsockopt(SO_LINGER)\swould\sbe\sset\swith\sl_onoff=1,l_linger=0\sprior\sto\sclosesocket()\sfor\san\simmediate\sabortive\sclose.\s\sclosesocket()\s_will_\s_not_\s_block_\swith\sthat\ssetting.\n\nThis\sunfortunately\sappears\sto\sbe\sin\sreverse\sorder\sand\smight\srender\sold\scode\spossibly\sbroken.\s\sBut\sgiven\sthe\snew\sability\sto\sdo\sa\shalf-close\sto\sinitiate\sa\sgraceful\sand\sthat\sresets\sare\salready\ssilent\sEOFs,\sall\smight\sbe\swell.\n\n
J login davygrvy
J mimetype text/plain
J username davygrvy
K 2446662fffffffffffffffffffffffffffffffff
U davygrvy
Z 95e99a610725f58e89fdff48d1244110