?
Solved

Forcefully Freeing a Socket

Posted on 1998-09-24
4
Medium Priority
?
361 Views
Last Modified: 2013-12-23
In Solaris 2.5, I'm running an Oracle web listener.
If a client somewhere is using it, I want to be able
to forcefully terminate use of the socket, free the
socket, and restart the listener.

I can kill the listener, but cannot restart it since
Solaris thinks the socket is still in use.  Even
though the listener has long since died,
issuing "netstat -a" gives:

LocalAddr     RemoteAddr   Swind Send-Q Rwind Recv-Q State
robkuo.9000  roboropc.2757  7964   0  8760   0  ESTABLISHED

How can I tell Solaris to FREE THAT SOCKET???
Many thanks!

0
Comment
Question by:stesul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:zhongbing
ID: 1582361
1. there is no way in traditional unix systems to free a socket. if it preserve by the program. and if the program abort abnomally without close it corretly. it will be in close-wait for a long time. it decided the by the 3-handshake protocal of the socket connection establish and close.
2. so i think the only way is "tcp stop" .
zhong
0
 

Author Comment

by:stesul
ID: 1582362
You mention the command: "tcp stop" .
But no such command exists on my Solaris 2.5.1 system.  What system
are you referring to?  What do you do on a Solaris 2.5 system?
Thanks!
0
 

Accepted Solution

by:
ydsh earned 800 total points
ID: 1582363
Put these codes into your client program:
 
struct linger socketLinger;

        socketLinger.l_onoff = 1;
        socketLinger.l_linger = 0;
        if(setsockopt(sockfd,SOL_SOCKET,SO_LINGER,
                           &socketLinger,sizeof(struct linger)) == -1){
                perror("set sock opt error");
                return(-1);
        }      
Then you can forcefuly terminate the use of socket, and free it.
                                                               
0
 

Author Comment

by:stesul
ID: 1582364
Thanks for your answer.  It answers the question, IF I have source
for the client.  Still, it is a good answer, so I give it an A.

But if I DON'T have source for the client or server, how do I free sockets?
Is there a way?

Many thanks!

0

Featured Post

Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
This program is used to assist in finding and resolving common problems with wireless connections.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question