Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5877b506d76f02768f4a0c656c7c8a52da5f6444
Ticket: 1306694fffffffffffffffffffffffffffffffff
Sockets are not working in the child processes
User & Date: rbalakri on 2005-09-28 09:32:09
Changes

  1. assignee changed to: "andreas_kupries"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    When a process is forked and if socket is executed
    within the child process the socket is not accepting
    the incoming connection.
    
    Tcl version: 8.4.11
    Platform: Linux
    
    Tcl Version is compiled with threading enabled. The
    following is the sample server (daytime server) program
    to reproduce the problem,
    
    proc Server {channel clientaddr clientport} {
       puts "Connection from $clientaddr registered"
       puts $channel [clock format [clock seconds]]
       sleep 30
       close $channel
    }
    
    if { [fork] } {
           # Parent
            wait
            exit
    } else {
           # child
            socket -server Server 9900
            puts "child waiting for sockets"
            vwait forever
    }
    
    The corresponding client program,
    
    set server localhost
    set sockChan [socket $server 9900]
    gets $sockChan line
    close $sockChan
    puts "The time on $server is $line"
    
    After the server is started and after starting the
    client netstat comman gives the following output,
    
    [root@myhost test]# netstat -atp | grep 9900
    tcp        0      0 *:9900                      *:*   
                         LISTEN      4309/tcl
    tcp        0      0 myhost:36222          myhost:9900 
             ESTABLISHED 4291/tcl
    tcp        0      0 myhost:9900           myhost:36222
             ESTABLISHED -
    
    The first one is the server's listening socket, second
    is clients socket and third is server's connected
    socket. As you can see the sever's socket doesn't have
    the application associated with it.
    
  4. foundin changed to: "obsolete: 8.4.11"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "rbalakri"
  9. subsystem changed to: "24. Channel Commands"
  10. title changed to: "Sockets are not working in the child processes"
  11. type changed to: "Bug"