How to get the gateway?
-
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?Please help!
-
@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.
ifconfig
orip
on posix OSes, andipconfig /all
on 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.