LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Allocate fixed port for program (https://www.linuxquestions.org/questions/linux-newbie-8/allocate-fixed-port-for-program-786832/)

kalawana1986 02-03-2010 10:54 PM

Allocate fixed port for program
 
I have written a program which uses port 5000. I need to restrict other programs use this port when I'm not running that program. In Linux are there a mechanism to restrict port 5000 accesses from other programs. Any idea please...

paulsm4 02-03-2010 11:34 PM

All you have to do is:

a) have your server bind to the port
b) leave your server running

PS:
I'm oversimplifying a bit, but that's really pretty much all you have to do most of the time ... and it's usually sufficient.

IMHO .. PSM

PPS:
If some other service happens to bind to your port first, you can easily identify the culprit with a tool like "lsof".

chrism01 02-03-2010 11:46 PM

Other options:

1. write a short dummy prog to bind to that port when the real one is offline
2. if root access; set an itpable rule to block that port when not running.


All times are GMT -5. The time now is 04:17 PM.