Log in

View Full Version : Accessing laptop's webserver through activesync.


MFO
08-29-2002, 03:09 PM
Ok, here is the deal.

Say you have a PoketPC connected through ActiveSync to your computer (a safe thing to assume here).

Normally you can surf the web and pick up email by making use of your Computer's internet connection.

My question is this: how do you access your own computer?

If you try to access http://localhost/ (aka http://127.0.0.1), the Pocket IE will try to access a web server running on your PPC (which could exist).

But how do I access my computer?

Is there a way to see the TCP/IP routing table on the PPC? It must have something like that since it knows to look locally for "localhost" yet look across the activesync connection for anything else.

The plan here is to control apps on my laptop by using my iPAQ (via a Bluetooth activesync connection). I can write a web app that will give a list of MP3 playlists I have, and run one when selected, for example.

But since I can't access the web server on my laptop.....no go.

I could probably get clever and alias an additional IP on my laptop and then manually add something to the routing table telling it to route such requests to the loopback adapter (aka localhost). That would probably work, but I am looking for something cleaner if possible.

Any ideas?

David McNamee
08-29-2002, 03:24 PM
You'd access it the same way you would from any other machine on the network - by host name or IP.

For example, my laptop is named HARPO. From pocket IE, I could type in http://HARPO/ and be taken to the default page on the server - if I had one.

Even though the PPC is sharing the host's connection, it has it's own identity (mine is GROUCHO) and does not assume the host's name, IP, etc. That's why localhost doesn't work the way you seem to have been expecting.

HTH

MFO
08-29-2002, 03:46 PM
The thing is, that doesn't work.

That gives an error message "Trouble Connecting" with an option to change settings (the same you get for any invalid hostname). That's because HARPO is not a valid IP address or Internet host name. It is a local alias on your computer, and thus is unknown to your PPC.

And since my machine has a dynamic IP address for internet access, there is no specific IP there to use. And besides, this really has nothing to do with the internet, I just want to access the machine on the other end of the activesync connection. I don't need internet access for that, though I do need TCP/IP.

And localhost does work the way I expected. Which is why I asked for a way to find the IP address of the computer (from the perspective of the PPC). If there were a way to see the routing table this address would be the default gateway on the PPC.

To fool the PPC I did what I mentioned before. First I turned off DHCP for my laptop's ethernet card and gave it a static IP. The only reason for doing this is because you need to have a static IP in order to be able to add additional IP aliases. I added an IP alias for address 10.0.0.1 (mask 255.255.0.0) and no gateway (therefore it assumes the loopback adapter).

When I access 10.0.0.1 on the PPC now it knows it is not a local address and routes it across the activesync connection. My laptop on the other hand knows that it owns that address, and sends it locally to my webserver. I get the result I want, but have to turn off DHCP.

This will not work in all environemts since some people MUST have DHCP enabled on their computer.

I'm looking to possibly make a piece of software for distribution, so I can't have people manually configuring IPs on their computer and disabling DHCP as part of the process.

Follow me?

David McNamee
08-29-2002, 04:09 PM
The thing is, that doesn't work.
Interesting. I've used that trick on several machines on different networks. All those networks used DHCP also. I even tried it before posting earlier to make sure it did work.

That's because HARPO is not a valid IP address or Internet host name.
It is a valid host name on my network. That's why it is able to resolve when I type it into the address bar of pocket IE.

It looks like you did a lot of work for something that should have been simple to get working. I'm not sure what the culprit could be that's giving you trouble, but if I get any ideas, I'll be sure to post them.

MFO
08-29-2002, 04:18 PM
It is a valid host name on my network.

Ahhhhhh, on your network. That's the key phrase.

I'm not on a microsoft network, so therefore my machine name won't resolve to an address. When you are on a MS network the machine name does basically what the 10.0.0.1 address does for me. The machine name gets resolved by the MS network's DNS server to your IP - thus giving the desired result.

My laptop is just a standalone machine. And what I am looking for would need to work without any internet access at all (but still with TCP/IP, as I said). Home users will rarely be logging onto a MS network.

David McNamee
08-29-2002, 04:57 PM
What OS is running on your laptop? I can experiment with a stand-alone configuration sometime in the next few days. Also, from where are you getting the IP for your laptop - your ISP? Should I assume that you don't have an always on connection to your ISP?

MFO
08-29-2002, 05:04 PM
Laptop is running Win2k SP3.

The IP from my ISP is dynamic, and not always present. It should not be part of the equation.

An IP for the network card is assigned by the OS when you set it to get the IP from DHCP (even though there is no DHCP server present). This usually give it a 169. address, which I assume is in one of the public IP ranges.

Currently I have it configured with a static IP in the same address range.

Thanks for the help.