0

I am sending this custom packet over a TCP socket

pkt = IP(len=16384, src='192.168.240.243', dst=ip,
        id=RandShort(), ttl=64)/TCP(sport=5000,
        dport=5000, flags="S", window=200,
        options=[('MSS', 1460), ('WScale', 2)])/CustomLayer(type=1, update=2)/"SENT"

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:    
    s.connect((ip, 5000))
except socket.error:
    print 'User not connected'

spkt = str(pkt)
s.send(spkt)

The packet is correctly sent and received, but I can't send more than one. If I try for example to include this in a while(i<10), only one packet is received, the others are marked as [TCP Retransmission] looking in Wireshark.

How can I send the packet more than once within the same socket?

1
  • 1
    I have no experience, but I guess you'd need to change the id attribute of the packet so that the under laying IP stack will think it's a different packet. Commented Nov 22, 2015 at 10:35

1 Answer 1

1

Your packets have the same ID, so they are the same packets, and therefore discarded as duplicates.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. However I think I will switch to UDP protocol.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.