Windows CE ActiveSync TCP connection
I have a .NET compact framework program that has my CE device open a socket to my PC over the USB cable's ActiveSync connection. Everythin开发者_开发问答g works fine, except when I'm trying to use a laptop that isn't connected to a network. Then the CE device throws a SocketException
with an ErrorCode = 10061
, which I tracked down as a WSAECONNREFUSED -- Connection refused
error.
After a bit of debugging, I discovered that the exception was being thrown because the DNS lookup (using System.Net.Dns.GetHostEntry
) was only returning a Loopback... and, obviously, the CE device isn't running the server code to accept the connection...
So, any ideas on how I could: a) trick my computer into thinking it's on a network, b) reference the machine a CE device is connected to via ActiveSync in a manner other than by its hostname, or c) some other option I don't know about yet?
Don't use the hostname to resolve the PC. Instead use 'ppp-peer'.
精彩评论