LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-03-2010, 10:54 PM   #1
kalawana1986
LQ Newbie
 
Registered: Feb 2010
Posts: 1

Rep: Reputation: 0
Question 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...
 
Old 02-03-2010, 11:34 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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".

Last edited by paulsm4; 02-03-2010 at 11:36 PM.
 
Old 02-03-2010, 11:46 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,397

Rep: Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign fixed port to nlockmgr rwcooper Slackware 11 06-15-2010 06:33 AM
netfilter fixed my router port forwarding problem telexl LinuxQuestions.org Member Success Stories 4 10-30-2009 09:03 AM
Unable to allocate port with port forwarding software djeepp Linux - Networking 3 01-29-2008 07:28 AM
can we allocate skbuff in user program shrishailnk Linux - Networking 1 03-20-2006 10:13 PM
port probe on fixed IP behind router fails ask Linux - Networking 4 10-22-2005 02:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration