Artifacts Associated With Ticket 219298ffffffffff
Ticket change [a7268c5f7e] (rid 98735) by nobody on 2000-10-26 05:10:20:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 2634 Bug Version: 8.2 SubmitDate: '1999-08-31' LastModified: '2000-04-14' Severity: LOW Status: UnAssn Submitter: techsupp ChangedBy: hobbs RelatedBugIDs: 1776 OS: Windows NT Machine: X86 FixedDate: '2000-10-25' ClosedDate: '2000-10-25' Name: Waidelich Comments: winsock reports the failed close correctly. only a peer 'shutdown' is not reported correctly. I want Tcl to become cleaner every release. Workarounds are a real pain. ReproducibleScript: # SOCKET BUG (Win95 and NT?) is portability problem # ================================================= # checked with Tcl 8.0.3, 8.0.4, 8.1.0 and 8.2.0 # reported to Scriptics when 8.0.3 was released # # test-script follows # # connect to non-existent port fails without error report # fconfigure -error does not work on Win95 and only half on WinNT (no posix) # there is a workaround (fconfigure -peername) # # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # QUESTION: shouldn't a failed connect be reported by a READable socket? # I think this is how it worked with C on SCO-UNIX. the read can then # reports the error. A WRITEable socket does not mean # we have data to send. So no system call, no error report... # wm geometry . +300+10 text .t -yscrollcommand ".s set" -bg yellow -width 60 -height 25 scrollbar .s -command ".t yview" pack .s -side right -fill y pack .t -fill both -expand yes proc debug t { .t insert end "$t\n" .t see end update idletasks } proc rrr sock { debug "$sock readable" catch {read $sock} x global errorCode debug "read <$x> errno=$errorCode" } proc www sock { debug "$sock writable" global errorCode # from the manual: ...determine if an asynchronous connect operation succeeded. # I expected to get ECONNREFUSED (winsock 10061) # but got nothing catch {fconfigure $sock -error} r debug "-error <$r> <$errorCode>" # A workaround gives ENOTCONN --> I coude fake a ECONNREFUSED to user catch {fconfigure $sock -peername} r debug "-peername <$r> <$errorCode>" # fileevent $sock writable {} ;# don't loop # catch {close $sock} r debug "close <$r> <$errorCode>" } proc ccc {} { debug "connecting to localhost:6666 (change if exists!)" set sock [socket -async localhost 6666] debug "$sock opened" fconfigure $sock -blocking no fileevent $sock readable "rrr $sock" fileevent $sock writable "www $sock" ;# writeable on connect! debug "waiting for fileevents..." } ccc ;# connect now #from the log: #============== # connecting to localhost:6666 (change if exists!) # sock14 opened # waiting for fileevents... # sock14 writable # 95: -error <> <> # NT: -error <connection refused> <> ... no POSIX in errno # # -peername <can't get peername: socket is not connected> <POSIX ENOTCONN {socket is not connected}> # close <> <POSIX ENOTCONN {socket is not connected}> ObservedBehavior: async connect gets reported differently on Win95 and NT although there is a workaround, it should be done how it was intended by the socket-abstraction DesiredBehavior: on failed async connect I expect the socket to become readable (and maybe writeable too?) on success I expect it to become writeable. And readable only if data is available. - foundin initialized to: "obsolete: 8.2"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "63. (unused)"
- title initialized to: "socket -async behaves differently on Win95 and NT"
- type initialized to: "Bug"
Ticket change [aab40f96a2] (rid 100973) by dkf on 2001-01-16 21:29:17:
- icomment:
I read somewhere that the difference between 95 and NT was due to the brokenness of 95. I could believe that...
- login: "dkf"
- mimetype: "text/plain"
- subsystem changed to: "90. FAQs"
- username: "dkf"
- icomment:
Ticket change [609b27d53d] (rid 116028) by dkf on 2001-02-07 22:58:26:
- subsystem changed to: "63. (unused)"
Ticket change [b4df7a10ef] (rid 125122) by dgp on 2001-04-01 01:47:31:
- subsystem changed to: "27. Channel Types"
Ticket change [6376fb720d] (rid 92585) by hobbs on 2003-07-19 03:37:44:
- closedate changed to: "2003-07-18T20:37:44"
- closer changed to: "hobbs"
- resolution changed to: "Out of Date"
- status changed to: "Closed"