Which would be the best data structure to use in network manager to handle packet loss across the network?
I am sending packets from one system to another [server/UDP]. packets are collected[client/UDP] and then they must be used ordered and written into a file.
there are 2 threads in the client system:
1) handles the packet loss like duplicate packets,send signal on missing packets
2) gets few packets at a time and writes it into a file.
I am using python. Which data structure shall i use to store the packet?, i want to sliding window algorithm for this. maximum 5 buffers and each buffers should hold a maximum of 10 packets.
If you want to create packets at the byte level and manage the protocols yourself, you should probably use the equivalent of a C style struct, which is provided by the struct package: http://docs.python.org/library/struct.html. This gives you more control of the memory layout of your packets.
If you don’t care about the memory layout, then you can just make your own class to hold the values you want.
You can probably just use the built-in python lists to implement the sliding window. They can be used as a double-ended queue, for example.