I've created my first Windows Mobile application mainly as a learning experience. I thought might as well share it.
I have to use Motorola MC5574 and a laptop without wifi card for work and got tied of sharing slow gprs connection to laptop while in the field.
Internet Sharing on MC55 won't allow me to share wifi over bluetooth or usb. Tried ICS Control but did not work for me.
So this application is created and finished after days of research on internet instead of adding on a wifi card to the laptop.
This program requires Microsoft .Net Compact 3.5.
I do not know if it will work on any other device.
I am not responsible if you use this application and crash your device or whatever else happens.
Main proxy function is based on open source C# proxy server code. Basic DNS proxy and ping functions are added and compiled with SharpDevelop. I could not add soft input panel in SharpDevelop so there is no keyboard icon available.
To use:
Press IP button to list ip addresses.
Select server ip address by using < or > buttons.
Uncheck DNS proxy if used together with built-in Internet Sharing.
Leave it checked if used together with WM6BTPAN.exe and manually put in DNS and Gateway address (server ip address) on laptop bluetooth lan driver.
Press Start.
Don't forget to change socks proxy option in the browser on laptop.
To use with usb connection: On mobile, under ActiveSync>Connections, uncheck "Synchronize all PCs..." and reboot before the usb cable is connected to laptop. If ActiveSync on laptop connects proxy does not work.
In my experience Firefox works better with this app then Internet Explorer for some reason.
Connection limit (on the right of port number) is to prevent process overload by client connections especially on web pages with a lot of elements. It may be better to set the limit higher on the program and change network.http.max-connections value on Firefox.
01/24/2011
New Version: 1.1.
Added KB button for keyboard.
Added DHCP service to make connections easier.
Added DNS resolve function for sharing ActiveSync connection.
Example: if the Internet connection through ActiveSync is shared as [Internet > Router > LAN > PC > ActiveSync > USB > WM phone > Proxy > Wifi Ad-Hoc > another WM phone]:
On PC, in ActiveSync connection settings, check “allow wireless connection” before connecting USB cable.
On the device running proxy: check browser to make sure it is connected to Internet. Create an Ad-Hoc connection with static address (example 192.168.15.1, subnet 255.255.255.0, no gateway address). Wait until connected with client device (which should be set to dynamic IP address). They should connect even though the client will have wrong IP. If they do not connect at this stage don’t bother with next steps.
Once connected start proxy or click on IP button if already started. The Wifi IP address 192.168.15.1 should show up. Set that as proxy server address, check DHCP, and check DNS with 127.0.0.1 as DNS server address. Click Start.
If the Wifi Ad-hoc connection still works the DHCP client count should change in a couple of minutes. If not make sure to keep the devices a few feet apart and also try turning Wifi off and on from the client phone to force DHCP discover again.
On the client phone: Settings > Wifi > configure network adaptors to “connect to work”. In Settings > Connections > Work Network > setup proxy server > enter proxy server as “socks=192.168.15.1” (example proxy server address) > advanced > HTTP > change port to proxy port (default 9876) so that the screen shows HTTP as “socks=192.168.15.1:9876. Socks port setting does not matter, as Mobile IE seems to connect using HTTP setting.
Note:
Tested between Motorola MC5574 and a Samsung Omnia i910. Wifi Ad-hoc connection on Omnia side is unstable and cannot be used as host.
Therefore Internet>MC55>Wifi>Omnia works but Internet>Omnia>Wifi>MC55 does not work reliably.
Nice. Have you seen the SOCKS proxy app from pchasco? http://forum.xda-developers.com/showthread.php?t=414389
I don't know if its this new ****ty 3in1 router Comcast has forced on us recently or what but I cannot connect to my external IP on my phone while on my own wifi network. For example Transdroid; I use my external IP as the server so that when I'm swapping in and out of 3G/wifi I'm not having to keep changing it. However now, it will only connect to the server when I'm on 3G, not wifi. If I change the IP to a local address, then it connects on wifi but obviously not 3G. Not really sure what the deal is and it's not only Transdroid that has this problem. Emit, my VNC applications and a couple others are having the same issue. Just doesn't want to connect to my own external ip address while I'm on my network. Makes no sense. Any ideas?
Your router probably doesn't support NAT reflection (or it's disabled). NAT reflection is basically a set a firewall rules that redirects connections to your external IP to the respective internal IP. For example:
Your external IP is 111.222.333.444
Your internal IP is 192.168.0.10
Your forwarded port is, say, 80
1) When you connect from your own WIFI with NAT reflection enabled (by default on most routers), this is what happens:
You connect to 111.222.333.444 on port 80. Your router tells your phone that the actual IP is 192.168.0.10 and it should connect to that instead.
2) When you connect from your own WIFI with NAT reflection disabled, this is what happens:
You connect to 111.222.333.444 on port 80. Your router tries to connect to that IP and as you know, when you connect to anything on the internet, only the external IP is visible. So, the router sees that both the source IP and the destination IP are 111.222.333.444. The router doesn't know how to handle this.
Try to see if there's a configuration option for this in the router's web interface. You may need to unplug the router afterwards. I hope this helps
- Hi, I want to start an hotspot app just like the default hotspot tethering network in android device and make some improvement for that. But at first, I have no knowledge about it at all.
- So does anyone have kinda document that related to the android hotspot. How is the mechanism to send, receive packet ??? What is it all about ??? Please recommend for me.
:highfive::highfive:
You need to :
1. turn your wireless interface (wlan0) into AP mode (Access point )
2. Configure security type /password for the connection (look for iwconfig ..)
3. turn on dhcp on the wlan0 interface , set the router option and DNS option to the IP of wlan0
4. Enable masqurading(NAT) on your mobile connection such that traffic coming from your tethered device will be natted (look for iptables ).
This setup needs root .
I am in university halls of residence. I have setup a Wi-Fi hotspot in my room using a generic router by connecting from the ethernet out port in the wall to a ethernet LAN port and disabling DHCP on the router.
This works perfectly for my Windows 7 laptop. It connects to the router and then to the uni internet without issues. However, although my Samsung Galaxy S3 (International i9300) can detect the network, if I just try to connect to the network as I would any other it gets stuck when obtaining an IP address. After messing around with it for a bit i found that I could get the phone to connect by going into the advanced settings and choosing "static" instead of "DCHP". I don't know what I was really meant to enter for IP Address, gateway, subnet, DNS 1 and DNS 2.
The router has the IP of 192.168.1.1 when i connect it directly to my laptop via ethernet so I tried that as the gateway, I set the IP address to something like 192.168.1.14 (So that it was similar but different), I set the subnet to 255.255.255.0 and the DNS servers I used google's (8.8.8.8 and 8.8.4.4). This got me connected to the router but there doesn't appear to be any internet connection.
I therefore thought that I had entered wrong information for the network (I was only guessing after all). Therefore I went into ipconfig in Windows and copied the default gateway and DNS servers and used a similar IP address (Last number different). I had the same issue.
Does anyone have any suggestions?
I only want Wi-Fi in my room for mobile.
I need persistent SSH access to my Android device from Internet. There are many apps that can listen ports on device external IP, but main problem is that most of Russian (and, I think, many other countries) cellular providers (GPRS, 3G, LTE, etc) close all ports from external access, even if device have white IP address. So via cellular network there are no way directly connect to device, and I can get direct access device only via WiFi neworks.
I want find any way for organize persistent access to my device via static address and port. The way where I don't need to check current wifi ip address of each network and type it for give access, but use something stable like myphone.somehost.com:12345.
Popular way for this is organize SSH Tunnel via external ssh server with white IP address. I have the server and already try this way (SSHDroid app as SSH server with bind to localhost:2222 port; SSH Autotunnel app for organize tunnel), but the problem is with too slow reconnecting after Android device change IP address (got reconnect on cellular network, or swith to/from WiFi) - problem with establishing new connection can continue about 10-30 minutes - this is too long.
So the Question: Is there any way to organize stable direct TCP/IP access to custom port on Android device, that work normally and reconnects quickly on unstable network with often reconnects and switch wifi/3g network.
Programs like Airdroid and Webkey provide direct access to device via http protocol, and works good via unstable connection. But I need to connect via SSH and other open protocols, not via some web interface.
Murz said:
I need persistent SSH access to my Android device from Internet. There are many apps that can listen ports on device external IP, but main problem is that most of Russian (and, I think, many other countries) cellular providers (GPRS, 3G, LTE, etc) close all ports from external access, even if device have white IP address. So via cellular network there are no way directly connect to device, and I can get direct access device only via WiFi neworks.
I want find any way for organize persistent access to my device via static address and port. The way where I don't need to check current wifi ip address of each network and type it for give access, but use something stable like myphone.somehost.com:12345.
Popular way for this is organize SSH Tunnel via external ssh server with white IP address. I have the server and already try this way (SSHDroid app as SSH server with bind to localhost:2222 port; SSH Autotunnel app for organize tunnel), but the problem is with too slow reconnecting after Android device change IP address (got reconnect on cellular network, or swith to/from WiFi) - problem with establishing new connection can continue about 10-30 minutes - this is too long.
So the Question: Is there any way to organize stable direct TCP/IP access to custom port on Android device, that work normally and reconnects quickly on unstable network with often reconnects and switch wifi/3g network.
Click to expand...
Click to collapse
I've managed this thing in the past with:
A continuously running server with a static IP address running SSHd with the option "GatewayPorts on". Let's say the server is at ssh.example.com.
You have to run an sshd daemon on your Android device.
You can then run the following script on your Android device:
Code:
#!/system/bin/sh
REMOTE_HOSTNAME=ssh.example.com
FORWARDED_PORT=2000
while :
do
ssh -R " $FORWARDED_PORT:127.0.0.1:22" "$REMOTE_HOSTNAME” "sleep 86400"
sleep 60
done
You'd have to change FORWARDED_PORT for every Android device and strange for authentication.
Once you have this set up you will be able to connect from anywhere by sshing to ssh to ssh.example.com port 2000.
Fif_ said:
Once you have this set up you will be able to connect from anywhere by sshing to ssh to ssh.example.com port 2000.
Click to expand...
Click to collapse
Fif_, thanks, I already try this way via SSHDroid and SSH Autotunnel, but after each disconnect (device change IP) I got lost connection abut 5-20 munites - new port forward cannot be established, because old session is still active and waiting timeout, and after 10-20 retries timeout is end and new ssh tunnel established normally.
If I decrease SSH timeouts to 5 seconds, I got very often disconnects and reconnects, that eats traffic and device battery. And after each disconnect I got dropped session on client side and need to connect again for continue working.
So SSH Tunnelling is bad way for non-stable and slow internet connection with dynamic IP address.
At now very popular is websocket protocol, that seems works well on bad connection and quickly restore session after disconnecting and changing IP (without aborting processes). But I can't understand how I can use it to proxy SSH session.
Murz said:
Fif_, thanks, I already try this way via SSHDroid and SSH Autotunnel, but after each disconnect (device change IP) I got lost connection abut 5-20 munites - new port forward cannot be established, because old session is still active and waiting timeout, and after 10-20 retries timeout is end and new ssh tunnel established normally.
Click to expand...
Click to collapse
You can mitigate that issue by checking that the reverse tunnel is up and running on the server.
If you create the following as checkssh:
Code:
#!/bin/bash
set -eu
while :
do
coproc nc localhost "$1" || exit 1
banner=''
read -t 30 banner <&${COPROC[0]} || exit 1
case "$banner" in
SSH-*) ;;
*) exit 1;;
esac
eval "exec ${COPROC[1]}>&-"
wait || :
sleep 30
done
Then change that line in the script I sent before:
Code:
ssh -R "$FORWARDED_PORT:127.0.0.1:22" "$REMOTE_HOSTNAME" "/path/to/checkssh $FORWARDED_PORT"
You should have much more luck keeping the connection up.
You may want to tweak timeouts to conserve battery.
Murz said:
If I decrease SSH timeouts to 5 seconds, I got very often disconnects and reconnects, that eats traffic and device battery. And after each disconnect I got dropped session on client side and need to connect again for continue working.
So SSH Tunnelling is bad way for non-stable and slow internet connection with dynamic IP address.
At now very popular is websocket protocol, that seems works well on bad connection and quickly restore session after disconnecting and changing IP (without aborting processes). But I can't understand how I can use it to proxy SSH session.
Click to expand...
Click to collapse
Have you thought about running an always-on VPN?
If say you run an always on VPN from your phone to a target machine, then with a little bit of iptables trickery you can achieve what you want.