Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

内核有提供网卡连线状态的信息 #1

Open
rankaiyx opened this issue May 21, 2021 · 2 comments
Open

内核有提供网卡连线状态的信息 #1

rankaiyx opened this issue May 21, 2021 · 2 comments

Comments

@rankaiyx
Copy link

好东西
不过也许搞复杂了
内核有提供网卡连线状态的信息
cat /sys/class/net/eth0/carrier
如果carrier为1表示connect,否则disconnect
这里网卡eth0仅为举例

@rankaiyx
Copy link
Author

我之前也弄了一个C语言版 和你思路一样

@fengmlo
Copy link
Owner

fengmlo commented May 21, 2021

感谢提醒,这个信息很有用,有空了我改一版试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants