Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7978773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:34:51+00:00 2026-06-04T09:34:51+00:00

I have a client application, which uses a unmanaged dll for communicating with a

  • 0

I have a client application, which uses a unmanaged dll for communicating with a server.

All network-related operations are perormed inside the unmanaged dll.
After a number of operations with the server, the client is running out of TCP ports.
If we check the state of netwotk using ‘netstat -an’, we get the following result:

...
TCP    192.168.11.55:56048    192.168.10.28:5000     FIN_WAIT_2
TCP    192.168.11.55:56049    192.168.10.28:5000     FIN_WAIT_2
TCP    192.168.11.55:56050    192.168.10.28:5000     FIN_WAIT_2
TCP    192.168.11.55:56051    192.168.10.27:5000     FIN_WAIT_2
TCP    192.168.11.55:56052    192.168.10.28:5000     FIN_WAIT_2
TCP    192.168.11.55:56053    192.168.10.27:5000     FIN_WAIT_2
TCP    192.168.11.55:56054    192.168.10.27:5000     FIN_WAIT_2
TCP    192.168.11.55:56055    192.168.10.27:5000     FIN_WAIT_2
TCP    192.168.11.55:56056    192.168.10.27:5000     FIN_WAIT_2
TCP    192.168.11.55:56057    192.168.10.28:5000     FIN_WAIT_2
TCP    192.168.11.55:56058    192.168.10.27:5000     FIN_WAIT_2
TCP    192.168.11.55:56059    192.168.10.28:5000     FIN_WAIT_2
TCP    192.168.11.55:56060    192.168.10.27:5000     FIN_WAIT_2
...

The ports are released only after the client is closed.

If I run the VS project in Debug Mode, it never runs out the ports.
But, while running in Release mode, it is happening.

And I don’t have access neither to server nor client source.

How to release or kill those ports which are in FIN_WAIT_2 state?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:34:53+00:00Added an answer on June 4, 2026 at 9:34 am

    When a socket is in FIN_WAIT_2, the local socket was closed and is waiting for the remote socket to send their close request. If this close request never arrives, the socket will remain in the FIN_WAIT_2 state for a while.

    The reason behind this is that if the close request from the remote party would be delayed and arrive after another application reuses the socket, that new connection would be instantly closed.

    You can change the timeout if you want, but in the end the unmanaged dll has not fully implemented the TCP shutdown sequence. For more information see

    http://answers.microsoft.com/en-us/windows/forum/windows_7-networking/how-to-close-finwait2-connections-except-reboot/ba2fed9f-8b61-4b71-ab5b-d39dc9a387e3

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a client-server application, which communicates using WCF, and uses NetDataContractSerializer to serialize
I have a multi threaded client server application which uses Sockets. When a new
I have a client/server style application which communicates using WCF which all works great.
i have a client-server application which uses .NET Remoting communication. For authentication reasons i
If I have a Server/Client application that both reference the same DLL which contains
I have a client server application in which the server and the client need
I have a client server application in which I need to transmit a user
We have a Server/Client cybercafe management application which used to work fine on Windows
I have a client-server Silverlight application, which is use Socets. I have server appliaction
I am developing an application in C# WPF which will have Client-Server architecture (Client

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.