LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 11-13-2008, 01:37 PM   #1
tugboat
LQ Newbie
 
Registered: Nov 2008
Posts: 3

Rep: Reputation: 0
created too many sockets, now need to close them. . .


I've been building a php socket server for a flash chat application on my linux server.

For completely embarrassing, and slightly irrelevant, reasons, I ended up setting up quite a few socket servers, each using a different port, before I finally got one to work.

Now I'm left with a bunch of open, unnecessary sockets/ports which I'd like to close permanently.

I'm worried that these open sockets/ports represent a security threat, so I'd really appreciate any advice on how to close them. I would really really really appreciate it.

Thank you so much in advance.

Last edited by tugboat; 11-13-2008 at 01:41 PM.
 
Old 11-13-2008, 02:01 PM   #2
anonobomber
Member
 
Registered: Aug 2003
Location: Seattle
Distribution: Debian, Fedora, CentOS, FreeBSD, OpenSolaris
Posts: 138

Rep: Reputation: 16
You can use netstat to identify the processes that have the open sockets so that you can kill them. See the manpage for netstat for more information.
 
Old 11-13-2008, 03:42 PM   #3
tugboat
LQ Newbie
 
Registered: Nov 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you so much for your reply.

I used netstat to see which sockets were actively listening. Here's an example of one of the sockets I created:

Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 ip-xxx-xx-xxx-xxx.ip.s:9696 *:* LISTEN

What I don't know, now, is the proper syntax to kill this socket.

Again, I'd really appreciate any help.

Thank you.
 
Old 11-13-2008, 06:26 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Try
netstat -p --inet
 
Old 11-13-2008, 11:25 PM   #5
tugboat
LQ Newbie
 
Registered: Nov 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Wow, thank you Chris. Another great tool for me to have.

But it is a diagnostic tool, isn't it? Not really one with which one can 'undo' or 'kill' all those sockets and ports I set up.

But I'm starting to think that my ignorance in this matter is, perhaps, causing my confusion. Perhaps what you guys are telling me is that all I need is diagnostic tools? Perhaps you're telling me that all of those sockets and ports I set up while trying to create my chat room can just be left in existence and simply monitored in case of abuse?

Is this what you guys are telling me?

Thank you both for you patience and responses.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
close terminal mean close background process? Niceman2005 Linux - General 7 05-27-2010 02:58 PM
how to close port 1050 please help how to close it. mr norm Linux - General 1 09-12-2008 07:57 AM
Program to forward tcp sockets to unix domain sockets mikepol Linux - Networking 0 09-27-2007 09:49 AM
How do I close sockets? DittoAlex Linux - Networking 2 09-21-2007 08:06 AM
mplayer 'close all' doesn't close anything allelopath Linux - Software 2 12-08-2005 09:40 AM

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

All times are GMT -5. The time now is 11:07 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