Skip to content
Tcl Source Code History Of Ticket 218945ffffffffff
Login

History Of Ticket 218945ffffffffff

Artifacts Associated With Ticket 218945ffffffffff

  1. Ticket change [ad13b01c0a] (rid 101410) by nobody on 2000-10-26 01:08:27:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 2868 Bug
      Version: 8.2
      SubmitDate: '1999-09-23'
      LastModified: '1999-09-29'
      Severity: SER
      Status: Released
      Submitter: techsupp
      ChangedBy: hobbs
      OS: Windows 95
      Machine: X86
      FixedDate: '1999-09-28'
      FixedInVersion: 8.2.1
      ClosedDate: '2000-10-25'
      
      
      Name:
      Don Porter
      
      ReproducibleScript:
      #!/bin/sh
          # FILE: async
          # Usage: async <host> <port>
          #  exec tclsh "$0" ${1+"$@"}
          
          proc AsyncConnect {host port} {
              puts "creating socket..."
              set s [socket -async $host $port]
              puts "socket created"
              fileevent $s writable [list VerifyConnection $s $host $port]
          }
          
          proc VerifyConnection {s host port} {
              global connected
              fileevent $s writable {}
          
              # If there's an error condition on the socket (failure to connect),
              # then [fconfigure -error] should provide an error message
              #
              set msg [fconfigure $s -error]
              if {![string match {} $msg]} {
                  puts "Connection to $host:$port failed: $msg"
                  set connected 0
                  catch {close $s}
                  return
              }
          
              # Connection reportedly successful.  At this point we normally
              # configure the socket for whatever communications we want and
              # set up fileevent handlers to manage protocols over the socket.
              #
              # Here, as a simple check, print out the peername information
              # as a check of a good connection.  If we really are connected,
              # we print information about the far end of the connection.  If
              # not, print an error message indicating that Tcl's fileevent,
              # fconfigure, and socket are not working as advertised.
              #
              if {[catch {fconfigure $s -peername} peerInfo]} {
          puts "Tcl is broken: $peerInfo"
              } else {
          puts "Connected: $peerInfo"
              }
              set connected 1
              close $s
          }
          
          proc tick {} {
              # Demonstrate event loop is active, and provide eventual timeout
              global tick connected
              incr tick
              puts "tick $tick"
              if {$tick >= 6000} {set connected 0; return}
              after 10 tick
          }
          
          set connected 0
          set tick 0
          tick
          eval AsyncConnect $argv
          vwait connected
          # END FILE: async
      
      ObservedBehavior:
      C:> tclsh82 async www.w3.org 90
          tick 1
          creating socket...
          socket created
          tick 2
          ...
          tick 895
          Tcl is broken: can't get peername: socket is not connected
      
      DesiredBehavior:
      If the socket is not connected, I expect [fconfigure $socket -error]
          to return a non-empty error message, so that failure to connect can
          be detected by the callback routine after a [socket -async $host $port].
          
          Currently it appears the only way to check the socket for a successful
          connection is to catch [fconfigure $socket -peername].  That is an
          expensive operation which may block for awhile.  If I didn't mind
          blocking, I wouldn't be using [socket -async] in the first place.
      
      
      
      I am moving this to either fixed (or closed) for 8.2.1, because it
      gives me:
      
      (tkcon) 51 % AsyncConnect pop 90
      creating socket...
      socket created
      ## some waiting occurs here
      Connection to pop:90 failed: connection refused
      
      Which seems to be what the user wanted.  This is on NT/SP4. 
      -- 09/28/1999 hobbs
      Further notes from the user indicate that this works as expected
      for 98 and NT, but not 95.  This could either be a Tcl or MS
      problem, but not high priority for us to examine further. 
      -- 09/29/1999 hobbs
      
    4. foundin initialized to: "obsolete: 8.2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "69. Other"
    10. title initialized to: "[fconfigure $socket -error] broken"
    11. type initialized to: "Bug"
  2. Ticket change [8d0007fde0] (rid 127842) by welch on 2000-10-26 08:32:14:

    1. closedate changed to: "2000-10-26T01:32:14"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [5fdd80d4ea] (rid 115894) by dgp on 2001-04-19 03:31:29:

    1. closedate changed to: "2001-04-18T20:31:29"
    2. closer changed to: "dgp"
    3. resolution changed to: "Wont Fix"
    4. subsystem changed to: "27. Channel Types"