The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > UNIX and Linux Applications
Google UNIX.COM


UNIX and Linux Applications Questions involving software not covered by other forum go here. This includes Databases and Middleware.

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 06:22 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
Socket Programming socket soshell High Level Programming 2 06-29-2004 04:49 AM
C Prog to close a socket in established state teledelux High Level Programming 1 10-03-2001 08:42 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-01-2008
Registered User
 

Join Date: Feb 2008
Location: Nagercoil
Posts: 4
Stumble this Post!
any way to close socket

I have written a socker program. I have executed that program many times without closing the socket. So I want to find which all sockets binded with which file descriptor.

Is there any way to close those socket, which have been opened in that program's execution.

please help me!..
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-01-2008
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,325
Stumble this Post!
You can close a socket using shutdown(3SOCKET). Check the man page for arguments to pass in.
Reply With Quote
  #3 (permalink)  
Old 02-01-2008
Registered User
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
Stumble this Post!
Are you using the same port to bind?You can use the netstat command to find the state of the port.

Thanks
Nagarajan G

Last edited by ennstate; 02-01-2008 at 03:00 AM. Reason: added netstat info
Reply With Quote
  #4 (permalink)  
Old 02-01-2008
Registered User
 

Join Date: Feb 2008
Location: Nagercoil
Posts: 4
Stumble this Post!
Thank you very much..

Thank you,

I can find which ports has been still opened using that netstat function. but i want to close those ports. because my program will try to create the socket on the same port. if that port is already opened means, system cant create the socket or bind.

Can you tell me, how to close those socket ports.

Is there any way to close those ports which are left by the program to close.

Thanks in Advance.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




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


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

Content Relevant URLs by vBSEO 3.2.0