Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 762297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:56:27+00:00 2026-05-14T15:56:27+00:00

Here’s a simple python daemon I can’t manage to run as a background process:

  • 0

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.

EDIT: Here’s what I got from the shell:

ircd@smoky43g:~$ ls
server.py

ircd@smoky43g:~$ sudo nohup python server.py &
[8] 19817
ircd@smoky43g:~$

[8]+  Stopped                 sudo nohup python server.py
ircd@smoky43g:~$

I run it then just press the enter button – and it says ‘stopped’. What is the problem?

Without the sudo command, the similiar happen:

ircd@smoky43g:~$ nohup python server.py &
[9] 20341
ircd@smoky43g:~$ nohup: ignoring input and appending output to `nohup.out'

[9]   Exit 1                  nohup python server.py
ircd@smoky43g:~$

EDIT 2: I fount this in the nohup.out file:

python: can't open file 'sudo': [Errno 2] No such file or directory
Traceback (most recent call last):
  File "server.py", line 10, in <module>
    s.bind((host,port))
  File "<string>", line 1, in bind
socket.error: [Errno 13] Permission denied

UPDATE: I have managed to run it using the root account, but could not as the ircd user (that belongs to the suddoers). And the question now is why not?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:56:28+00:00Added an answer on May 14, 2026 at 3:56 pm

    I instrumented your code and it works fine here:

    $ cat server.py
    #!/usr/bin/env python 
    
    import socket 
    import sys
    
    host = '' 
    port = 843 
    backlog = 5 
    size = 1024 
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
    print >> sys.stderr, 'socket'
    s.bind((host,port)) 
    print >> sys.stderr, 'bind'
    s.listen(backlog) 
    print >> sys.stderr, 'listen'
    while 1: 
        try:
           client, address = s.accept() 
           print >> sys.stderr, 'accept'
           data = client.recv(size) 
           print >> sys.stderr, 'recv'
           # ignore data because I can't type a '\0'
           client.send('<?xml version="1.0"?><cross-domain-policy><allow-access-from domain="*" to-ports="*"/></cross-domain-policy>') 
           client.close()
           print >> sys.stderr, 'close'
        except Exception as e:
            print e;
            s.close();
            print >> sys.stderr, 'close'
            sys.exit(1);
    $ sudo nohup python server.py &
    [1] 11218
    nohup: ignoring input and appending output to `nohup.out'
    $ jobs
    [1]+  Running                 sudo nohup python server.py &
    # a couple of telnets to 843
    $ jobs
    [1]+  Running                 sudo nohup python server.py &
    $ sudo kill 11218
    $ sudo cat nohup.out
    socket
    bind
    listen
    accept
    recv
    close
    accept
    recv
    close
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 438k
  • Answers 438k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Just a guess, but it looks like DotNetBar is meant… May 15, 2026 at 4:27 pm
  • Editorial Team
    Editorial Team added an answer Check the "Bytes Read" output argument of ReadFile so you… May 15, 2026 at 4:27 pm
  • Editorial Team
    Editorial Team added an answer You forgot to call close() on ZipOutputStream. Best place to… May 15, 2026 at 4:27 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.