Hey all, I am trying to use socket to send / receive a packet (want to recreate some functionality of hping3 and port it to windows and mac as a tcp ping). I am having some problems with the recv functionality of socket. Below is the script I am using. I get an ack from the server (used wireshark to ensure it was working) when I run this, but the script doesn't see the ack for some reason and the script exits with this error or a timeout:
Traceback (most recent call last): File "./tcpgcmtesttristedit.py", line 21, in <module> s.recv(1024) socket.error: [Errno 104] Connection reset by peer Here is the script: import socket import time numberofpackets = int(raw_input("How many packets should be sent?\n> ")) hostname = 'mtalk.google.com' port = 5228 for i in range(numberofpackets): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(4) s.connect((hostname, port)) s.send('data') start_time = time.time() s.recv(24) print time.time() - start_time s.close() Any help would be much appreciated. Thanks, Tom. -- https://mail.python.org/mailman/listinfo/python-list