0

I'm working on a project where I need to implement reliable UDP in Python using socket. The goal is to create a class similar to socket.socket where the user can use methods such as connect(addr), accept(), close(), send(data), and recv(size) just like TCP, but on top of UDP.

Here are my questions:

How can I efficiently implement reliable UDP with ordering of packets and ack for packets with window size for unacked packets?

How can I implement a buffer to store incoming messages and serve the recv() method? I tried using bytearray and bytes, but they are very slow for large data.

Should I use threading to constantly listen for incoming messages and push them to the buffer while sending back acks?

Any guidance on these questions would be greatly appreciated. Thank you in advance!

  • Currently I tried to implement it with receiving thread which constantly tries to read new message and if it's ack it's update the unacked packets, if it's data it pushes it to bytearray
user207421
  • 305,947
  • 44
  • 307
  • 483
anonymous
  • 19
  • 1
  • 3
  • 2
    *"How can I efficiently implement reliable UDP ...."* - this question is too broad. Have a look at the TCP standard to understand what design is needed. Implementation is yet another issue - but too complex to answer it here. – Steffen Ullrich Mar 18 '23 at 17:20

0 Answers0