Checking whether Network IF can access Internet in C 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.
精彩评论