fork + socket -server fails



While debugging a problem with tclhttpd on Fedora Core 5, I noticed the
following changed behavior.

If I use [fork] from either Expect or Tclx in combination with [socket
-server], the socket does not accept connections. This works fine on
Fedora Core 4.

Here is the sample script that I am using. On FC-4 I can telnet to port
8015 and the script prints out the expected "Accepted connection:"
message. On FC-5, nothing is printed. Turning off selinux and the
firewall do not fix the problem.

#!/usr/bin/tclsh

package require Expect

set port 8015

if {[fork]} {exit}

set serverSocket [socket -server myAccept $port]
puts "$serverSocket listening on port $port"

proc myAccept {args} {
puts "Accepted connection: $args"
}

vwait forever

FC-4 uses tcl-8.4.9 and expect-5.43.0. FC-5 uses tcl-8.4.12 and
expect-5.43.0. Has something changed between 8.4.9 and 8.4.12 that
might cause this, or is it more likely something changed in Fedora Core
that is causing the problem?

--Wart
.



Relevant Pages

  • Re: Communicating with a servlet using NIO?
    ... TCP/IP uses the same port number as the listening ... port for incoming connections. ... connection to it - all communication beyond the initial connection by ... and returns the descriptor for the new socket. ...
    (comp.lang.java.programmer)
  • Re: Definition of a socket on Suns website
    ... the server gets a new socket bound to a different port. ... It needs a new socket (and consequently a different port number) so that it can continue to listen to the original socket for connection requests while tending to the needs of the connected client. ...
    (comp.lang.java.programmer)
  • Re: Socket and cycle problem
    ... listening this port countinously. ... So I need make some loop to print data from 3883 port permanent. ... the data it receives from each connection after the remote side drops ... If you were to use the socket module, then it would look something like this: ...
    (comp.lang.python)
  • Re: fork + socket -server fails
    ... If I use from either Expect or Tclx in combination with [socket ... On FC-4 I can telnet to port ... 8015 and the script prints out the expected "Accepted connection:" ... puts "Accepted connection: $args" ...
    (comp.lang.tcl)
  • Re: Socket class, connect to an endpoint with port 21
    ... It seems that you might have a FTP proxy server soemwhere in between. ... I'm developing a FTP Client using the socket class. ... to verify the connection I always use the Socket.Connected var. ... it always connects if the remote Endpoint uses the port ...
    (microsoft.public.dotnet.languages.csharp)