Help to run it in the background
Posted
by AlexPolo
on Stack Overflow
See other posts from Stack Overflow
or by AlexPolo
Published on 2010-04-25T12:35:59Z
Indexed on
2010/04/25
12:43 UTC
Read the original article
Hit count: 237
python
Here's a simple python daemon I can't manage to run as a background process:
#!/usr/bin/env python
import socket
host = ''
port = 843
backlog = 5
size = 1024
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((host,port))
s.listen(backlog)
while 1:
client, address = s.accept()
data = client.recv(size)
if data == '<policy-file-request/>\0':
client.send('<?xml version="1.0"?><cross-domain-policy><allow-access-from domain="*" to-ports="*"/></cross-domain-policy>')
client.close()
It's a socket policy file server (you may have heard of the restiction Adope put on socket connection - http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html); that works well when gets run like an "ordinary" process - "python that_server.py", - but I get problem to run it in the background.
Running like so: "that_server.py &", - does not work.
© Stack Overflow or respective owner