0

I'm writing code to send and receive packets. UDP packets are often ignored, so I am writing a retransmission code. The way I'm trying to make it is as follows.

When a UDP packet is sent, the recv() function waits for a response. Then, if there is no data coming in for 1 second in the recv function (use settimeout(1.0)), the first packet is sent again. Repeat this process through an infinite loop. This uses the settimeout() method of recv(). I don't know how to make it.

Sliced_ice
  • 37
  • 4
  • 1
    If the linked question does not help please me more specific than *"I don't know how to make it."*, i.e. show what you've tried so far and in which specific step you have which kind of problem. So far it looks more like a homework you need to solve and which actually contains all information you need - but that you are not unable to understand all these information. Try to lookup what `recv` and `settimeout` actually do - the Python documentation is good. – Steffen Ullrich Jul 16 '22 at 09:49
  • @SteffenUllrich What I'm curious about is after timeout I'm curious about the logic that implements the function of retransmitting data until it is completely received. – Sliced_ice Jul 16 '22 at 09:54
  • The logic is to catch the timeout error (as shown in answers to the linked question) and transmit again (i.e. `send`). Do this until the `recv` succeeds w/o error, i.e. wrap a loop around this. No idea what exactly your problem is here. Again - show what you've tried and don't expect others to provide you with code. It's your homework, not theirs. – Steffen Ullrich Jul 16 '22 at 10:13
  • @SteffenUllrich You are right. I'll try again. Thanks! – Sliced_ice Jul 16 '22 at 10:34

0 Answers0