0

I need to know if a connection is active while I'm sending streaming video (via UDP) from a Raspberry pi. The only way I could think of was to perform a ping every 5 seconds (to 8.8.8.8) using the 'watch' command. While this works, I'm concerned that if the processor must wait for the return during a ping, that might sometimes screw up my video stream.

I'm also open to any better suggestions.

2
  • "I need to know if a connection is active" - can you define this more precisely? Do you want to know that the Ethernet link is active? That you can communicate with a remote host? or That you can access the internet?
    – Attie
    Mar 16, 2019 at 19:33
  • Pinging someone else's server every 5 seconds isn't necessarily going to make you popular... and they can stop responding to ICMP echos at any time... try pinging a system that is under your control instead.
    – Attie
    Mar 16, 2019 at 19:34

1 Answer 1

1

Your Raspberry Pi will not "wait" for a return packet during the ping. It will just continue to do other things (such as streaming your video). When the returned ping packet arrives at the network interface of your Raspberry Pi, it will spend only a very short time processing the packet. Unless your RPi is already very stressed, this will not be noticeable.

So yes, your RPi will multitask and can do other things on the network while waiting for a ping to return, just as its Linux Operating System will multitask everything else.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .