开发者

NetworkInterface.GetAllNetworkInterfaces - How to get connected COM port

Using the .NET method NetworkInterface.GetAllNetworkInterfaces I can get a list of all network interfaces on the computer (Wireless & cabled Ethernet and 3G modems (PPP)). From the information provided to me from this how can I get the name of the COM port used by the 3G modem (PPP)? E.g. COM4

Thanks fo开发者_开发问答r any help provided.


Unfortunately NetworkInterface.GetAllNetworkInterfaces only returns the IP based interfaces.

Unlike USB, the serial port does not have any protocol for identification of connected devices you will need to take a somewhat heuristic approach. For example, you can get the list of serial ports using SerialPort.GetPortNames and then probe the ports with modem 'AT' commands to try determine which port the modem is connected to.

Here is a list of the basic AT commands, the 'ATIn' command might be of interest.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜