Windows Mobile: Internet on the device via code - windows-mobile-6.5

I have a device on Windows Mobile. The device have an access to the internet via WI-FI. I've tried to make a code to get response via Internet with WebHttpRequest and WebHttResponse.
string url = "http://172.20.24.83:80/ProductRESTService.svc/GetProductList/";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "GET";
req.ContentType = "application/xml; charset=utf-8";
req.Timeout = 300000000;
req.Headers.Add("SOAPAction", url);
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
It works fine on Emulator. Unfortunately I have an exception:
Could not establish connection to network on the device only
The device can get an access to the internet via browser, but I can't do it via code.
Do you have any ideas?

Although you say you can access the internet, is that the same private internet as the IP 172.20.24.83 is part of a private internet:
Private Internet Addresses:
10.0.0.0/8 IP addresses: 10.0.0.0 -- 10.255.255.255
172.16.0.0/12 IP addresses: 172.16.0.0 -- 172.31.255.255
192.168.0.0/16 IP addresses: 192.168.0.0 – 192.168.255.255
The question is, can your device's browser connect to 172.20.24.83?
I assume your PC is on the 172.16.0.0/12 network too, so the emulator is part of your PC and is also connected to this network.
But to which network is your device connected to when using the WiFi connection?
This may be a routing (different subnets) or switch/firewall issue.
Take a look at Start>Settings>Connections>WiFi and select the active WiFi adapter. This will show details about the IP address, subent etc of the WiFi connections. You may also use my NetStatCF to find out the details of the connection.

Related

How to force MacOS to send network packets to local proxy even when Wi-Fi is not connected

MacOS version: Mojave
I have a program listening on a local port(2080). I would like to forward all network requests to this program.
In order to accomplish this, I have configured the Wi-Fi network service to use a socks5 proxy as well as dns server pointing to local host.
This works as long as the Wi-Fi network service is connected to any network, regardless wether that network is connected to the internet. (For instance, a chromecast).
Is there a way to force the packages to the program without having to connect to a network?
Previous attempts include creating a network service attached to the lookback device, lo0, with the proxy and dns settings as before (couldn't get any packets to be routed through the program, network panel says not connected) And installing tun/tap discussed in this question.(Virtual network interface in Mac OS X).
The device will show up in ifconfig, but not in network services after editing the SystemConfiguration/preferences.plist
Any guidance is welcomed.
Nevermind I figured it out. The Tun/Tap will work, just need to configure the virtual network service with correct DNS and proxy settings.

How to configure IPV4 address and Subnet Mask

In Xamarin iOS we can connect to a Wi-Fi network using SSID and password as below
var config = new NEHotspotConfiguration(SSID, Password, false) {
JoinOnce = false };
var configManager = new NEHotspotConfigurationManager();
await configManager.ApplyConfigurationAsync(config);
provided HotSpotConfiguration is added in the app entitlement.
My question is
Is it possible to change Configure IP option from Automatic to Manual?
If yes, how to configure IP address and subnet mask?
1. In Xarmain.ios NEHotspotConfigurationManager is from Apple's native method.
NEHotspotConfigurationManager refer to this from apple , this from xamarin
A configuration manager that applies and removes hotspot configurations of Wi-Fi networks.
So it can not configure IPV4 address and Subnet Mask
2. However, NEIPv4Settings
NEIPv4Settings contains the Internet Protocol version 4 (IPv4) settings of a IP layer network tunnel. can do that.you can refer to here from apple , here from xamarin
They are all extend from NetworkExtension (Configure VPN tunnels. Customize and extend core networking features.)
So you can use NEIPv4Settings to do that.
If you want connect to a wireless access point that is not connected to the internet.The Wifi connection is established fine and I can access other devices on that LAN.In ios,you can do that.
3. Workaround
The Wifi connection on the iPhone/iPad must be configured as a static connection. You must specify an unused IP in the range of the wifi access point (e.g. 192.168.0.2). Specify a mask (255.255.255.0). Do NOT enter any router IP.
Once connected to that wifi network, you can access other devices connected to the same wifi LAN (e.g. 192.168.0.*).
And do that, WAN is accessible through 3G!
More info: If want to do VPN, you can study NEVPNManager ,also extend from NetworkExtension.

Private Server is accessed only by computers with IPs in range 10.10.20.XX

They say that IP addresses between the range 10.0.0.0 up to 10.255.255.255 can be used in private networks.
My work’s network has about 200 computers connected to each other using plain switch. At my office I own 2 computers which are connected to the network. The following configuration is true.
My PC1
IP: 10.10.20.113
Windows XP
Firewalls Off
No Proxy
Accessing PC2 from Firefox Browser using http://10.10.20.20 (It Works)
My PC2 (server PC)
IP:10.10.20.20
Windows XP, Apache Server
Firewalls Off
No Proxy
Server on this PC spits its homepage through the network at http://10.10.20.20
My private/local server above (PC2 with IP: 10.10.20.20) can be accessed only by Computers with IPs between the range 10.10.20.0 up to 10.10.20.255. A computer on the network that has an IP e.g. 10.10.30.30 throws a time out error. If I change Server's IP to 10.10.30.30 it works on networked computers in the IP range 10.10.30.XX but not on networked computers in the IP range 10.10.20.XX
How can I make my private server be accessed on any computer at the same private network with any IP addresses between the whole private range from 10.0.0.0 up to 10.255.255.255 ? Why god makes life difficult?
Thank U in advance !
It appears that your network has a mask length of /24. That means that the mask is 255.255.255.0. To access a network outside your network, you need a router. You wrote that you only have a switch so you need to add a router to route between networks.
Devices in the network 10.10.20.0/24 can only connect to devices in the 10.10.20.1 to 10.10.20.254 range. The 10.10.30.0/24 network has a range of hosts from 10.10.30.1 to 10.10.30.254. They are two different networks, and you need a router to route between those networks.

Access localhost ( running on Mac OS X ) from another machine in the network

I have a REST service running on Mac OS X, which im currently accessing using "localhost:8888" and "10.0.2.2:8888"
I want to access the same service from another computer which is in the same network.
I disabled the firewall also and I typed
nc -v 192.168.1.3 8888
and got the result as
nc: connectx to 192.168.1.3 port 8888 (tcp) failed: Connection refused
currently i use localhost (to access using java application) and 10.0.2.2 (to access using android application runs in the simulator) which both runs on the same machine which the server runs too.
I want to put the android application to my phone and give the machine ip addess ( because if i connect to internet via wifi, it'll be in the same local area network) i should be able to access my service runs on my machine.
can some one please tell me what im doing wrong here? Thank you
You can't access localhost from your front end code. It needs to refer to the server's name or address.
The localhost address should be 127.0.0.1, which is in the loopback range of addresses. Any address in the 127.0.0.0/8 block can never appear anywhere on any network, nor can any address in that block be used as a source or destination address outside a host. It is not possible for one host to access anything in that address range on another host.
The goes back at least as far as RFC 990, ASSIGNED NUMBERS:
The class A network number 127 is assigned the "loopback" function,
that is, a datagram sent by a higher level protocol to a network 127
address should loop back inside the host. No datagram "sent" to a
network 127 address should ever appear on any network anywhere.
RFC 1122, Requirements for Internet Hosts -- Communication Layers:
(g) { 127, }
Internal host loopback address. Addresses of this form MUST NOT
appear outside a host.
Also RFC 3330, Special-Use IPv4 Addresses:
127.0.0.0/8 - This block is assigned for use as the Internet host loopback address. A datagram sent by a higher level protocol to an
address anywhere within this block should loop back inside the host.
This is ordinarily implemented using only 127.0.0.1/32 for loopback,
but no addresses within this block should ever appear on any network
anywhere [RFC1700, page 5].

How to get Actual IPAddr from DDNS hostname

I am using Dyndns service for my PC. This allows me to get my PC's current Wan IPAddr from my ISP.
say I can use below WinForm app code to get the IPAddr by passing in this hostname example : Marina.dyndns.biz
public static void DoGetHostEntry(string hostname)
{
IPHostEntry host;
host = Dns.GetHostEntry(hostname);
Console.WriteLine("GetHostEntry({0}) returns:", hostname);
foreach (IPAddress ip in host.AddressList)
{
Console.WriteLine(" {0}", ip);
}
}
My PC link to a router which uses local ISP service.
Q1. Is this returned Wan IPaddr refered to my Router's External IPAddr ?
Q2. What if I have fixed an IPAddr for the PC say 192.168.1.90? then what is the returned IPAddr refered to?
Q3. How do I do in Windows Phone 7.1 Mango version to get my PC's IPAddr with above code?
Thanks
A while back I used a similar service however it installed itself as a service and used to monitor the network for changes. The way it should work is by making calls to its server and checking the ip request is coming from.
The router itself has the WAN and internally uses LAN IPs to then do a NAT for comms over WAN.
The WAP IP is the external router IP that is given out by the ISP
When you do a Dns.GetHostEntry(hostname) you will get 192.168.1.90 which is the LAN IP of you PC.. not the WAN IP.. WAN ip is accessible to Dyndns but not to our code / OS itself directly.
You can't access / scan for IP address for other devices from #WP&

Resources