Neo
Neo

Reputation: 13

Checking whether Network IF can access Internet in C Linux?

I'm writing a simple library for checking the internet access status of network interfaces by C on Linux.

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

Upvotes: 1

Views: 1121

Answers (1)

caf
caf

Reputation: 239041

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.

Upvotes: 1

Related Questions