Java Application To Switch WiFi Networks

ndutoit

Member
I have 2 WiFi networks at my house and I want to write a Java Application that will switch between these. The application should be able to accept DHCP and Static IP addresses as well as having an option in the application to add a new WiFi network to the app that it can switch to if it is in range.
 

beers

Moderator
Staff member
What are you actually trying to accomplish here?

It'd probably be faster to just click the network button on the tray and click the other SSID than to shuffle around and launch your application.
 

ndutoit

Member
That would be true for networks that do not require a static IP. My WiFi networks require a static IP to connect. The addresses for both networks are different and therefore I want to have a Java Application to handle the changing of networks and IP address settings on my computer and possibly my phone.
 

Cromewell

Administrator
Staff member
Is this homework? It sounds like homework.

You should be able to do most/all of this via a batch file (or bash scipt if linux) which wouldn't require loading the JVM
 

ndutoit

Member
This is just a new program project I'm working on.
I suppose a batch script will work but I don't know much of the code. And I also want to have a version of this for my mobile device.
 

Cromewell

Administrator
Staff member
netsh wlan connect ssid=network name=<profile name> interface=<name of interface>
netsh wlan disconnect interface=<name of interface>

Profile name is what you see in Manage Wireless Networks (or with netsh wlan show profiles) and interface is the name of the wireless adapter in Network Connections (or netsh wlan show interfaces)
 

Cromewell

Administrator
Staff member
Ok. How would I connect to a network using a static IP address using this method?
Sorry I missed your reply earleir. MSDN is pretty great for this stuff :)
netsh set address [name=]InterfaceName [source=]{dhcp | static [addr=]IPAddress [mask=]SubnetMask [gateway=]{none | DefaultGateway [[gwmetric=]GatewayMetric]}}
 

SpriteMidr

Active Member
PC and possibly mobile at another time.

Like what...Windows...Android..?

You might be able to do it using Windows universal platform...but I dont think that yu will do it in Java. Android uses its own standard library which is not Javas own
 
Top