Dns.GetHostEntry throws SocketException in WM2005, OK in PPC2003

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

Using C#, .Net CF 2.0, WM 2005 on Symbol MC9090

IPHostEntry Dns.GetHostEntry (String)
Throws:-
{System.Net.Sockets.SocketException: The system detected an invalid pointer
address in attempting to use a pointer argument in a call
at System.Net.Dns.ResolveInternal()
at System.Net.Dns.GetHostEntry()

The SocketException contains an ErrorCode (0x0000271e) that equates to the
following socket error:-
The system detected an invalid pointer address in attempting to use a
pointer argument of a call. This error occurs if an application passes an
invalid pointer value, or if the length of the buffer is too small. For
instance, if the length of an argument, which is a sockaddr structure, is
smaller than the sizeof(sockaddr).

The same call works on PPC 2003.

Can anyone shed any light on this?
 
I've had no problems with a WM5.0 device using GetHostByName for resolving
server names e.g.

IPHostEntry ihe = System.Net.Dns.GetHostByName("PPP_PEER");

Peter
 
This will fail with a socket exception if you are not connected. So you may
need to check the network status first, either way you should wrap in a try
catch.

Peter
 
Thanks for replying Peter,

I did have it in a try/catch and it was connected via a cable. Possibly an
issue with ActiveSync 4.5 Beta - don't know.

Incidentally, using PPP_PEER on WM2005 also throws an error; a less serious
unable to resolve address exception. This is still strange though, as I'm
able to use PocketPing to verify that the connection is there.
 
Are you sure that you're calling the method with the right signature. I've
done a resolve of PPP_PEER on a WM5 device while AS is connected and it
worked fine. The problem seems to be localized to your code.

Paul T.
 
Back
Top