Reputation: 57268
I have a Dell Axim Windows CE device (Windows Mobile 5.0 OS 5.1.1702 Build 14366.1.0.1) connected to a Dell Latitude E6500 laptop. My C++ application is running on the CE device and listening for TCP connections on port 80. The program tries to connect to itself using the address 169.254.2.1:80, and gets error code WSAECONNREFUSED (10061). This generally indicates that nobody is listening on that port. If I change the address to 127.0.0.1:80, the connection succeeds.
Here's the weird part. If I disconnect the device from that laptop and connect it to a Dell Latitude D830, everything works properly. The 169.254.2.1 address is the same, but connecting to it succeeds. Note that this is the application running on the CE device connecting to itself, not connecting to the laptop, nor is it the laptop connecting to the application on the device. We have confirmed this with a few different machines - all of the E6500's show the problem, nothing else does.
I don't understand how which machine the device is connected to affects internal TCP connections. Any ideas?
Upvotes: 0
Views: 5958
Reputation: 67188
First I have to ask why you're using 169.254.2.1 to connect to yourself. That IP address is an ActiveSync-assigned address, and it's not guaranteed to be static (it actually did change once in the past, when the driver went from USB serial to RNDIS) so using it is risky.
If you want to address yourself, use a standard loopback address like 127.0.0.1. If you want to address an activesync partner, resolve the host name ppp_peer
and let that give you the actual address.
My guess as to the source of the behavior is that when you connect to the PC, a local "LAN" is built with two nodes (the device and the PC). That LAN tends to not be a "full" network (for example ICMP packets don't get transmitted) and it's probably dependent on the driver loaded by the host PC. That's purely speculation, of course.
As I said, I'd like to know more about why you're using the address you are to see if we can "fix" the issue by doing something that's altogether a bit safer.
Upvotes: 2