router administrator change Wi-Fi channel programmatically with android - android

i would like if my question is possible or not.
Well every channel has a specefic frequency 1 à 13(2,4GHz), 36 to 64(5GHz) and 100 to 165(5GHz).
for example :
channel number 1 : 2412GHz ;channel number 2 : 2417GHz.
Well when we enter to the router interface from the localhost address ,we can easely choose a channel.
What i would like to do is to change the channel programmatically (from my android app ) .
I have an idea ,but i don't know if it's feaseble or not ,is to simulate the router web interface and do the same work that it doeas with android.
if someone has an idea please help me
PS: 'm the router adminsrator
Thank you

I think that is possible you connect to your router by SSH, and then, you change the configuration, and restart wireless, but, then, you will lost connection when channel changes.
However, I dont know if your router allow this operation with SSH
I have another idea:
With wireshark, see the HTTP packet sent between your PC and your router, when you does Login, and when you save configuration. If you understand them, maybe you make a new packet in your phone.
(sorry my English)

You can try to configure the router with SSH.

Related

Which method is called when someone tries to connect using WifiP2PManager.connect(Channel, WifiP2pConfig,ActionListener)?

I am tring to setup WIFI P2P on 2 devices using
manager.addLocalService(channel, service, ActionListener)
and then connect both devices using
manager.connect(channel, config, ActionListener).
I would like to know which method is called before the popup to accept/reject connection is shown on the target device. All I was able to find was onConnectionInfoAvailable(WifiP2pInfo p2pInfo), but it is called after the connection is established.
I basically want to receive the "instance name" of the device trying to connect to me using WIFI P2P and then reject the connection request without showing system dialog(that allows the user to accept/reject connection).
I can't anything that can help me do this on docs or any other place. If anyone knows how to do it or can point me in the right direction then please let me know.
I solved it. I can put the instancename and devicename (of device I want to connect to) in Map that is passed when setting up service. From other device I can retrieve map of all devices available using this and find the instancename of one I need.

pass string between two wifi direct connected user in android using wifi direct?

i have recently implement wifi direct into my project,my aim is pass string value between two wifidirect connected devices when some of my app condition satisfies.right now i have listed all peers and also made connection between the selected peer.now i need to pass String values to the connected devices..how can i pass string between two connected device. i have checked the [Wifi Direct chat][1]
[1]: https://github.com/life0fun/wifi-direct-chat project but it is very complicated.so any one suggest me any idea how can i pass the String values between two connected wifi device.(If code is needed i will post the code here)
you can use socket to connect between two peers in the same network.
for instance create a server socket on one of the peers on any port and then from the client side connect to that port on the other user . then you can use this socket connection to send strings, file whatever you want.
for starters i would recommend you employ the server socket on the group owner so it will be easier on your client side to get the ip of the peer(i.e group owner) using the groupOwnerAddress field provided by the api
refer to this -> http://www.oracle.com/technetwork/java/socket-140484.html
You can get text chat code from your installed SDK sample just goto
\sdk\samples\android-22\legacy\WiFiDirectServiceDiscovery
import that code into your eclipse, this is great sample in this text chating has been done nicely and code is too easy to understand.
I hope it will help you.

how to change port 80 android

I made a webserver on my android device(using Nanohttpd). It's working fine over the port 8080
but I want to make it okay over the port 80,(I want to tape on my browser : http://192.168.x.x instead of http://192.168.x.x:8080/ ) but I'm not able to do it
This is how I call the method that creates the webserver:
httpServer = new NanoHTTPD(80,Environment.getExternalStorageDirectory());
Can someone tell me what service is running by default over the port 80 ?
How can i fix this problem ?
I finally found a way to fix that, for those who have the same problem, here is the solution
I rooted the phone using UnlockRoot
then I installed Port redirector from the play store and I forwarded the traffic from port 80 to port 8080, and now my web server is available from the address: 192.168.x.x
Hope it will help :)
Ports below 1024 are restricted on Unix like systems. You need superuser privileges to bind to these "well-known" ports.
List of these "well-known" ports on wikipedia
Check out line 89 of the server source:
https://github.com/NanoHttpd/nanohttpd/blob/master/core/src/main/java/fi/iki/elonen/NanoHTTPD.java
I don't even see a constructor that type-matches your arguments. That might be part of the problem.

modify android.server.BluetoothService.java to update cached service_channel_no of paired device to open multiple connections to it(on mul. channels)

I am stuck at a place where my Android Phone(Samsung Galaxy) has to open 2(or more) connections to my PC(server) which is a paired device. For this purpose, I start SDP server on PC with UUID : 00001101-0000-1000-8000-00805F9B34FB and channel 2, after the first connection I unregister the SDP service on the PC and register it again on channel 3(and same UUID) and expect my android phone to 'connect' to it for establishing the second bluetooth connection. The second one fails.
The problem as I have figured out is that because of the pairing, the channel num and UUID of the device for the 'BluetoothSocket.connect' are serviced from cache and are not being updated, so my SDP change in channel num on the server side is not visible here as it still tries to connect to channel 2(old one).
A workaround of this problem(found after a lot of frustrating attempts) might be to change the android.server.BluetoothService.java file, by introducing
updateDeviceServiceChannelCache(addr) before returning in the getRemoteServiceChannel() and fetchRemoteUuids() so as to update the channel number at each func call.
The above solution may well be wrong, please pardon me for that. If it is correct please suggest any further changes and how to make this change permanent in eclipse, or in other case(wrong solution), the right way of doing this.
Note: I have android 2.3.5 and the requests from the device are actually from the browser that I forward to the PC. I want them on separate channels.
thanks.

Android: Using tiwlan0 to determine wireless connected status for Droid

I want to be able to check the status of Droid's wireless and I was hoping that by reading /sys/class/net/tiwlan0/wireless/status I could find out if it was actually connected or not. I already know that I can check if my wireless is enabled/disabled but I want my app to notify the user if the wireless gets disconnected.
However, the Droid I have is not rooted and I do not have permission from the owner to root it and I need to know the type of the value (e.g. long, boolean, byte) before I can proceed.
Any help or suggestions about other ways I can go about this would be greatly appreciated!
Thanks
You should just be able to listen to the SUPPLICANT_STATE_CHANGED_ACTION broadcast. It will notify you of a change (scanning, association, disconnection, etc.) in the form of a SupplicantState object inside an extra.
Install terminal emulater, run it and type the following at the command line: "ifconfig -a". Read the IP address listed under tiwlan0.

Categories

Resources