LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-27-2004, 08:34 PM   #1
THETEZ
LQ Newbie
 
Registered: Mar 2004
Distribution: Redhat 9
Posts: 6

Rep: Reputation: 0
Question Close socket/port


is there a command to close a socket or port thats already in use
 
Old 03-28-2004, 11:04 AM   #2
Technonotice
Member
 
Registered: Mar 2004
Location: UK
Distribution: Debian Unstable
Posts: 58

Rep: Reputation: 15
Re: Close socket/port

Quote:
Originally posted by THETEZ
is there a command to close a socket or port thats already in use
Run netstat -lp as root and in the last column, it will list the PID of the process and its name. You will then know which program is opening the port and shut it down.

HTH,
 
Old 03-28-2004, 11:40 AM   #3
THETEZ
LQ Newbie
 
Registered: Mar 2004
Distribution: Redhat 9
Posts: 6

Original Poster
Rep: Reputation: 0
i dont have a way to shutdown my program yet so im using ctrl+z

the process is not running but the port is still being used

Last edited by THETEZ; 03-28-2004 at 11:44 AM.
 
Old 03-28-2004, 03:16 PM   #4
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
If a program is not using a certain port then the port will not stay open. Using ctrl+z places the process in the background which means its still running. You have to use ctrl+c to terminate the process.

What port are you talking about?
 
Old 03-28-2004, 08:05 PM   #5
THETEZ
LQ Newbie
 
Registered: Mar 2004
Distribution: Redhat 9
Posts: 6

Original Poster
Rep: Reputation: 0
Thanx killing the process worked. I thought control z killed it because i tried it before and it told me "process so and so doesnt exist"
maybe i put in the wrong pid.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Which port should I close? schneemann Linux - Networking 5 11-15-2005 03:15 AM
close a port mfrangos79 Linux - Security 7 11-03-2005 01:32 AM
race condition in close socket?? jwstric2 Programming 3 03-18-2005 05:01 PM
cant get port 21 to close crosswire Linux - Newbie 4 09-14-2004 06:17 PM
How do you close port 22 SSH? Linux~Powered Linux - Security 7 03-16-2004 11:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:26 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
Open Source Consulting | Domain Registration