Thanks for the feedback. Using the socket in a list is great
However, as i imagined, I now get a limit of around 1500 conns before the system crashes out, also i have noticed, that the ports loop back to 1025 when they hit 5000. Any ideas on how to make the list/socket get to around 50K TIA Alan <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On May 19, 10:25 am, "Alan Wright" <[EMAIL PROTECTED]> wrote: >> Hi Folks, >> I am newbie to Python, but have successfully created a simple client and >> server setup, I have one issue though. >> >> I am trying to test a box by sending many TCP conns (WHILE loop) but not >> closing them with a FIN/RST. However, no matter what i do, i cannot get >> the >> loop to stop sending FIN from the client. >> >> Any clues? >> >> Here is my current script >> >> #!/usr/bin/python >> >> import socket,sys >> from numpy import * >> num1=0 >> >> while (num1<=10) : >> >> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >> s.settimeout(10.0) >> s.connect(("10.1.1.69", 50008)) # SMTP >> print s.recv(1024) + '\n', >> num1=num1+1 >> #s.close() >> >> sys.exit(1) > > socket.socket instances do an implicit close() on the socket when the > object is destructed (in this case, it's destructed when it is garbage- > collected). What's happening is that on each iteration, the variable > "s", which references the socket.socket instance, is assigned to a new > socket.socket instance, therefore the instance of the previous > iteration is no longer referenced by "s", and since it's no longer > referenced by anything, the instance is garbage-collected, > automatically imposing an implicit close() on that instance. A simple > solution could be to create a list and append the socket.socket > instance of each iteration to that list, that way the instances would > remain referenced in the list and not be garbage-collected; though you > might be able to find a more elegant solution. > > Sebastian -- http://mail.python.org/mailman/listinfo/python-list