From: SourceForge.net <no...@so...> - 2005-09-28 17:57:33
|
Bugs item #1306694, was opened at 2005-09-28 02:32 Message generated for change (Comment added) made by hobbs You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1306694&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 24. Channel Commands Group: current: 8.4.11 >Status: Closed Resolution: None Priority: 5 Submitted By: Ravi Shankar. B (rbalakri) Assigned to: Andreas Kupries (andreas_kupries) Summary: Sockets are not working in the child processes Initial Comment: 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. ---------------------------------------------------------------------- >Comment By: Jeffrey Hobbs (hobbs) Date: 2005-09-28 10:57 Message: Logged In: YES user_id=72656 Fork and threads are not a valid combination. If you have a threaded build, please use another thread, not fork. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1306694&group_id=10894 |