Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to get the gateway?
victor wang last edited by A Former User
Hi, i'm using Qt5.5 on my computer.
I'm trying to get the gateway and ping it on my test program.
But i can't find any class that could do what i want.
Does anyone get any advice?
@victor-wang There isn't an easy way to get it with Qt. You'll have to do it on each platform you need to support with native c++ code.
You can be lazy and shell out to exes on each platform to get the information but it's best if you actually do it with code rather than using a console app.
ipon posix OSes, and
ipconfig /allon windows. You would still need to parse the results and such so it's probably better to just write the code to do it. :)
A quick google search will net you plenty of examples on each platform I'm sure. On Windows it's like
GetAdapterInfo()or something like that. Linux and OSX are super easy too.