Sign in to follow this  
Followers 0
wsabourin

TCPCloseSocket not releasing socket?

2 posts in this topic

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!

Share this post


Link to post
Share on other sites



TCPStartup() before the for loop

TCPShutdown() after the loop

Add some error handling...

If Not $socket = -1 Then

send

close

endif

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
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
Sign in to follow this  
Followers 0