I'm doing a client in Python, who registers into a server. That client sends a UDP packet to register
and waits for a register accepted
response packet from server.
There's the possibility that some packets are lost, because it's UDP, so I need code to:
Send packet and wait 5 second for response, if no packet received, send again the packet and then wait 10 seconds, if already no response, now 15 seconds and if again no response, break the loop.
My problem is that to receive packet I'm doing:
skt1.sendto(pqtUdp,(srvAdr,prtUdp))
data,addrs = skt1.recvfrom(56)
And rcvfrom is a blocking method. I searched and I think that using select
I could know when I receive a packet to then read the socket and get it, but I have no idea how to do it, I don't find select
easy examples for what I'm doing.
Could someone give me some help please?
Thanks!