Re: Starting New Process



Thanks, Jean-Paul - is there any way to do it without using Twisted,
since I am not very familiar with it? (i.e. just using the os library)
Thanks.

Jean-Paul Calderone wrote:
On 1 Jun 2006 07:34:23 -0700, D <duncanm255@xxxxxxxxxxx> wrote:
Hello, I need to write a server program that performs the following
tasks:

1) Listens on TCP port 5555 for a connection
2) When client connects, launches application (for example, vi), then
closes connection with client
3) Goes back to listening on TCP port 5555 for an incoming connection

Untested:

from twisted.internet import protocol, reactor

class ViRunner(protocol.Protocol):
def connectionMade(self):
reactor.spawnProcess(
None,
'/usr/bin/setsid',
['setsid', '/usr/bin/vi'])
self.transport.loseConnection()

f = protocol.ServerFactory()
f.protocol = ViRunner
reactor.listenTCP(5555, f)
reactor.run()

Jean-Paul

.



Relevant Pages

  • Re: Sockets
    ... I'll have a server application that will listen on a tcp port and make ... share the socket connection across the two threads? ... accepting client connections, thread 2 will we writing data to it.) ... def connectionMade: ...
    (comp.lang.python)
  • Failure Sending a Fault: System.Net.Sockets.SocketException
    ... I have a service and client that use WSE 2.0 and soap.tcp. ... Client connects to a public machine's tcp port which is ... If I send a request to service, it is received, but I can't get the ... Failure Sending a Fault: System.Net.Sockets.SocketException: A connection ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Starting New Process
    ... Listens on TCP port ... When client connects, launches application, then ... closes connection with client ... Goes back to listening on TCP port ...
    (comp.lang.python)
  • RE: RWW not working on some client desktops
    ... On a SBS-based computer, the Remote ... > Web Workplace uses TCP port 4125 for its remote desktop feature. ... > remote computer's connection request. ... > problematic client workstations? ...
    (microsoft.public.windows.server.sbs)
  • Re: Starting New Process
    ... Sorry, I should've specified - I'm familiar with sockets, but I was ... When client connects, launches application, then ... closes connection with client ... Goes back to listening on TCP port ...
    (comp.lang.python)