I have a client constantly sending UDP packets to host by Wifi connection through a router. I would like to know what happen to the packets if i suddenly turn off the router. Will the udp packets be dropped or be kept in a certain buffer?
Also, i want to know what happen to the packets if i turn on back the wifi a moment after i turn it off.
I need what tools in android linux to prove whether the packet is dropped(and at which layer) or kept in a certain buffer(access to buffer to verify it is the packet that i sent)?
According to UDP's nature, the packets will start dropping (lost) if the network is unreachable.
And once the network is re-established, the packets will start arriving to the destination with the best effort (but not the lost ones).
To test this behavior, you may simply create a Client-Server model application (either in Android, .NET or any language you like) in which client starts sending UDP packets (including serial number and date stamp) to the server and the server audits the arrived/lost packets. During the transmission, you may put the network down in order to observe the behavior and test your required case(s).
Once the network is down, your Client application will keep on sending the packets without knowing the unavailability of network and meanwhile all the flushed packets will be lost. Once the network is resumed, the transmission will resume too.