Avatar of Tom Knowlton
Tom Knowlton
Flag for United States of America asked on

Closing web service client does not close connection - but can it be done manually?

When I close my web service client (by calling .Close( )  ) it does not close the underlying socket connection on the server, but leaves it in a TIME_WAIT state:

 TCP    [::1]:64844            [::1]:65119            TIME_WAIT       0

This is not a bug, it is by design.  Under normal conditions, this is not a problem.  But when the application is scaled up, we begin to experience problems because new connections are not being released fast enough to accommodate the new web service method calls.

My research has indicated that the minimum time setting "clean up" old socket connections is 30 seconds.

We've also doubled the number of available connections.

For now the doubling of the connections seems to be alleviating the problem.

We understand that the web service seems to not be able close the connection manually.

My question is - how might we close the connection manually?


I know that the reason the connection will not close sooner than it does is because it is waiting for any packets that may arrive out of order.  And, the OS wants to ensure that a packet intended for a connection that is closed does not get processed by a connection that is still open.

That works for the OS, but it does not work for our needs.  We are writing the code so we know when the work is done and the connection can be closed.  If we could reduce the amount of time below 30 seconds - say down to 5 seconds - that might be an okay alternative.


I want to explore this as an option.
WCF

Avatar of undefined
Last Comment
Tom Knowlton

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Aaron Jabamani

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Tom Knowlton

ASKER
I can check on this.  The system has been in place for a while, so I would imagine this has been addressed at some point.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck