开发者

Checking whether Network IF can access Internet in C Linux?

开发者 https://www.devze.com 2023-04-13 03:58 出处:网络
I\'m writing a simple library for checki开发者_运维知识库ng the internet access status of network interfaces by C on Linux.

I'm writing a simple library for checki开发者_运维知识库ng the internet access status of network interfaces by C on Linux.

  • Checking the status for all network interfaces (configured or not configured)

Would you please give me where i can refer ( such as documents, example code ...) or any hints?


The simplest method is probably to check for the existence of a default route through that interface. You could call out to /bin/ip route to do this.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号