Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: dee0c49586c043db85e82098cf3937c3ab4f4da9
Ticket: 219301ffffffffffffffffffffffffffffffffff
Tcl_Main misses file events unless [update] is explicitly ca
User & Date: nobody on 2000-10-26 05:10:22
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 2660 Bug
    Version: 8.2
    SubmitDate: '1999-08-31'
    LastModified: '1999-12-03'
    Severity: SER
    Status: UnAssn
    Submitter: techsupp
    ChangedBy: hobbs
    OS: Solaris
    OSVersion: 2.6
    Machine: Other
    FixedDate: '2000-10-25'
    ClosedDate: '2000-10-25'
    
    
    Name:
    Michael Santos
    
    Extensions:
    BLT 2.4i (but not required for above)
    
    Comments:
    I have had similar problems in programs using Tcl_DoOneEvent().  In this
        case, the connection is established correctly (ConnectPort() is called),
        but subsequent communication is impossible.  The server seems to ignore
        communication on the channel even though Tcl_CreateChannelHandler was
        used to setup a callback.  This latter problem seems to only happen when
        Tcl 8.2 is compiled with threads support.  Disabling thread support
        seemed to restore the correct behavior.  If I can adapt the test program
        for this case, I will submit another bug report.
    
    ReproducibleScript:
    When opening a TCP server socket and using Tcl_Main in an interactive
        application, connections will be ignored unless "update" or "update
        idletasks" is explicitly invoked on the command line.
        
        Below is a simple C file to illustrate.  Connecting to the specified
        port with some other program will not generate the message in
        ConnectPort() until you invoke update on the command line.
        
        #include <stdio.h>
        #include <tcl.h>
        
        Tcl_Interp *gInterp;
        
        void 
        ConnectPort(ClientData clientData, Tcl_Channel new_socket,
            char *hostName, int port) {
          fprintf(stderr, "ConnectPort() called with hostname %s, port %d\n",
          hostName, port);
        
          Tcl_Close(gInterp, new_socket);
        }
        
        
        void
        StartServer(ClientData clientData) {
          Tcl_Channel socket;
          fprintf(stderr, "StartServer() called.\n");
          socket = 
            Tcl_OpenTcpServer(gInterp, 50099, NULL, 
              ConnectPort, (ClientData)NULL);
          if (!socket) {
            Tcl_Exit(1);
          }
        }
        
        
        int 
        Tcl_AppInit(Tcl_Interp *interp) {
          gInterp = interp;
          if (Tcl_Init(interp) != TCL_OK) {
            fprintf(stderr, "Tcl failed to initialize.\n");
            Tcl_Exit(1);
          }
        
          StartServer(NULL);
        
          return TCL_OK;
        }
        
        
        int 
        main(int argc, char *argv[]) {
          Tcl_Main(argc, argv, Tcl_AppInit);
        
          return 0;
        }
    
    ObservedBehavior:
    As mentioned above, connecting to the server socket will not result in a
        call to ConnectSocket() until "update" is entered on the command line of
        the server process.
    
    DesiredBehavior:
    I expect to see the behavior of 8.0.5 (and previous versions -- haven't
        ever tried 8.1).  With 8.0.5, the server program will print the
        ConnectPort() message immediately upon connecting to the port from
        another program.  No update call is needed to trigger it.
    
    
    
    
    
  4. foundin changed to: "obsolete: 8.2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "49. Threading"
  10. title changed to:
    Tcl_Main misses file events unless "update" is explicitly ca
    
  11. type changed to: "Bug"