Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rate Thread Display Modes
Old 05-11-2003, 10:00 AM   #1
God of Muffins
Prospect
 
Join Date: Apr 2003
Location: Middle, Nowhere
Posts: 11
Question Kill TCP/UDP Connections?

I have been looking for a command that will kill an internet connection (TCP or UDP). Does anyone know of one?

I don't know what else to say
__________________
iMac G3, 350 MHz, 192 MB RAM | Mac
OS X.2
God of Muffins is offline   Reply With Quote
Old 05-11-2003, 10:09 AM   #2
yellow
Moderator
 
Join Date: Jan 2002
Posts: 10,677
Need more info. What kind of "internet" connection? From where? You can always find the process (command: ps) running on the machine locally and kill it (command: kill).
yellow is offline   Reply With Quote
Old 05-11-2003, 10:18 AM   #3
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,459
more info needed

I assume you mean that you have somehow detected that some program is communicating via TCP or UDP and you want to stop it. What information do you have about this "connection"?

If you know which program is doing this (you can find out via 'sudo lsof -i'), you could, of course, stop it by killing the program. I assume you don't want to do this.

You could stop further transmission of data by setting up a firewall rule to prohibit that. You would do this via 'sudo ipfw' but exactly what rule needs to be added would depend on the particulars of the situation. Search these forums and the main macosxhints pages and you will find discussion of how to use 'ifpw'.
hayne is offline   Reply With Quote
Old 05-11-2003, 11:36 AM   #4
God of Muffins
Prospect
 
Join Date: Apr 2003
Location: Middle, Nowhere
Posts: 11
Well, you can see a list of active internet connections using netstat, so I was wondering if you could disconnect any of these with another command.

The Finder often gets locked up trying to connect to an FTP or AFP or SMB server, so I thought I would try killing the connection via the Terminal, to see if it would work.

It could also have other uses.
__________________
iMac G3, 350 MHz, 192 MB RAM | Mac
OS X.2
God of Muffins is offline   Reply With Quote
Old 05-11-2003, 12:15 PM   #5
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,459
not possible

As far as I know, it is not possible for a program to kill another program's socket (which is what you are talking about).

Are you on the most recent OS release? I had one experience that seemed to indicate that the SMB hang (in Finder) is more or less fixed in 10.2.6
I had an SMB share mounted and I disconnected the network cable. The Finder spun its wheels for a little while but did recover fully quite shortly.
hayne is offline   Reply With Quote
Old 05-11-2003, 02:50 PM   #6
yellow
Moderator
 
Join Date: Jan 2002
Posts: 10,677
Last night I experienced an FTP lockup on my home machine when I set my firewall on the remote machine to start denying packets in the middle of use. I was experimenting with connecting to an ftp server through the "Connect To Server" menu. Unfortunately, the entire machine froze up and I was unable to get to a prompt to try and kill the offending session. As far as I know there's no simple command to disconnect/kill sockets in use that you see from netstat.

Depending on what you want to kill, you can try and kill the process of the binary using the sockets if it's listed. Again, using ps and kill should do the trick for you.
yellow is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

Forum Jump



All times are GMT -5. The time now is 06:27 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.