|
|
#1 |
|
Prospect
Join Date: Apr 2003
Location: Middle, Nowhere
Posts: 11
|
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 |
|
|
|
|
|
#2 |
|
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).
|
|
|
|
|
|
#3 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,938
|
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'. |
|
|
|
|
|
#4 |
|
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 |
|
|
|
|
|
#5 |
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 31,938
|
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. |
|
|
|
|
|
#6 |
|
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. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|