Re: Starting New Process
- From: "D" <duncanm255@xxxxxxxxxxx>
- Date: 1 Jun 2006 11:08:04 -0700
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
.
- Follow-Ups:
- Re: Starting New Process
- From: Carl
- Re: Starting New Process
- References:
- Starting New Process
- From: D
- Re: Starting New Process
- From: Jean-Paul Calderone
- Starting New Process
- Prev by Date: Re: os.walk trouble
- Next by Date: Re: ideas for programs?
- Previous by thread: Re: Starting New Process
- Next by thread: Re: Starting New Process
- Index(es):
Relevant Pages
|