Handling Linux Network Connectivity in Java/C++?
I am working on a program to handle connections in Ubuntu. I am currently doing it in Java, but aim to do it in C++ too. Essentially, atm I am just running system commands through Java:
proc.exec("ifconfig wlan0 down");开发者_开发技巧 etc.
I get some printout saying it is 'deconfiguring interfaces' and 'fail' is printed out. First off, does anybody know why?
Secondly, can anyone think of a better way of doing this? In the end, I want the program to have the computer run an Ad Hoc network, drop the connection and connect to another network, and pick up the Ad Hoc again when it is done with the other network.
Thanks in advance!
Probably you can try to interface NetworkManager, which uses D-Bus as its interface, and there exists Java implementations of the protocol.
精彩评论