Jump to content

TCPCloseSocket not releasing socket?


Recommended Posts

The long story short is I am trying to create a test application that will connect, send a string and disconnect then repeat the process thousands of times in a short order to validate our application. The application interface takes messages from a port its listening on and then triggers further events within another system as such I want to be able to load up our system under test however I am running into a problem.

Every 16000 triggers the sends fail for a few thousand attempts as the system runs out of sockets and tries to free them up. I started writing this app in .NET but found trying to free sockets was a pain in the behind and had similar issues where windows itself runs out of available sockets, no matter how I close or dispose of them.

Here is the most simplistic code to demonstrate this issue:

for $i = 1 to 100000
    TCPStartUp()
    $socket = TCPConnect ( "127.0.0.1", 13000 )
    TCPSend($socket, "test")
    TCPCloseSocket($socket)
    TCPShutdown()
Next

I basically use another application I wrote to listen and print out the incoming messages to a console window, and there are no resource leaks from what I can see using process explorer. Any help with immediate reuse of sockets would be welcome in ether AutoIT or C# thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...