Get link speed programmatically?

后端 未结 2 1299
一整个雨季
一整个雨季 2020-12-05 11:45

I am writing an application that reports attributes of network devices on the local machine. I need the mac address, mtu, link speed and a few others. I\'m using udev for th

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-05 12:30

    You can get the link speed in bit per second using the sysfs interface:

    cat /sys/class/net/eth0/speed
    1000
    

提交回复
热议问题