0

So I'm trying to run 1 perl script multiple times but I am only able to run the first time while getting a permission denied message for the all other instances.

ERROR: (HTTP::Daemon: Permission denied) at script.pl line 50.

How do I fix this?

3
  • What deos the script do? Does it open a port? Commented Aug 7, 2015 at 14:16
  • Can you share a simplified version of your script.pl so we see what you are trying to do? But at first glance it seems you are trying to run multiple HTTP daemons. Do they have different local ports? Commented Aug 7, 2015 at 14:19
  • We can't tell you without a bit more detail on what your script is doing. Commented Aug 7, 2015 at 14:32

1 Answer 1

1

From the looks of it, your script creates a web server that listens on a specific port. Only one socket can be bound to a port at a time, so the attempt to create the second one fails.

The solution is probably to avoid binding to a specific port.

  1. Remove LocalPort => ... from the arguments passed to HTTP::Daemon->new.
  2. After the HTTP::Daemon object is created, get the port using $d->peerport().
  3. Communicate the port to the client that will connect to the HTTP server.
  4. Have the client connect to the communicated port instead of the one to which it currently connects.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.