The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
socket close() -w- pthreads linux 2.6.18.2-34 (suse) SMP ramen_noodle High Level Programming 1 02-06-2008 07:22 AM
any way to close socket pa.chidhambaram UNIX and Linux Applications 3 02-01-2008 07:12 AM
Close Socket at HP-UX Renato Gregio HP-UX 2 08-14-2007 07:04 AM
socket close hangs and CPU go to 100% arico HP-UX 0 08-22-2006 09:35 AM
Sniffing an established port matrixmadhan IP Networking 5 06-16-2005 06:03 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-03-2001
Registered User
 

Join Date: Oct 2001
Posts: 1
C Prog to close a socket in established state

I have a SUN environment running an WebLogic that communicates w/a 3rd party running IIS. When the IIS site goes down (frequently), I am stuck with sockets in an ESTABLISHED state, and cannot seem to figure out how to avoid this. No exceptions are thrown as I can still open connections to the IIS site, but no data is returned.
What I would like to do is to determine from lsof -i tcp@host, the file descriptors, and then determine how long they have been in ESTABLISHED state, and then close them if they are older than say 1 hour.....

Any ideas????

As always- all help and assistance is greatly appreciated.
Reply With Quote
Forum Sponsor
  #2  
Old 10-03-2001
Registered User
 

Join Date: Sep 2001
Posts: 40
Here ya go

No point in replicating work,


unless you want to, go to www.monkey.org/~bugsong/dsniff.html

This is a suite of programs that are used for network troubleshooting, please respect them as such. There is a tool in the suite called tcpkill, you can download the source tar file, and tear it apart. He does some very cool stuff with networking here, I suggest a good read of the whole thing, very informative.

THis is also available from the BSD ports and packages collections.



You should be able to take the tcpkill code and work it into a script ( if you want to do that ) with lsof providing the input. Obviously you'll need to compile it, and I believe that it does depend on some of the other files for declarations and such, check the Makefile for exactly what you have for options.



HTH,



loadc
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0