开发者

how to use "system call" to determine ethernet status on linux?

usually I use ping to det开发者_如何学Cermine ethernet status, like:

ping -c 1 -w 1 <ip_addr>

how could we use system call to determine ethernet status? and how could we embedded this method in java codes?


ping doesn't determine ethernet status; it sends a packet and waits for a response, so it is used to end-to-end test a network.

You can of course write your own ping, there are plenty of examples on the internet. Under Linux you generally need to be root to use the type of sockets required.

If you do genuinely just want to determine whether the link is active, have a look at the output of

ip link sh 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜