LinuxQuestions.org
Register a domain and help support LQ
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, 11: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-04-2010, 12:34 AM   #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-04-2010 at 12:36 AM.
 
Old 02-04-2010, 12:46 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
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 07:33 AM
netfilter fixed my router port forwarding problem telexl LinuxQuestions.org Member Success Stories 4 10-30-2009 10:03 AM
Unable to allocate port with port forwarding software djeepp Linux - Networking 3 01-29-2008 08:28 AM
can we allocate skbuff in user program shrishailnk Linux - Networking 1 03-20-2006 11:13 PM
port probe on fixed IP behind router fails ask Linux - Networking 4 10-22-2005 03:51 PM


All times are GMT -5. The time now is 03:54 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration