Newbie: Keep TCP socket open

Alan Wright alan.wright at volubill.com
Mon May 19 11:25:28 EDT 2008


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) 





More information about the Python-list mailing list