Compact Framework Socket class does not work.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have been trying to develop a “ping†program for our Pocket PC 2000
wireless handheld computer.

I have developed a Dot Net C# ping program using ICMP, TCP and UDP for the
normal Windows XP environment and they all work fine. However, I am having
problems getting them to work with Pocket PC 2000.

I can use IE on the Intermec 700C to attach to one of our web servers so I
know it is talking on the network.

I am using Visual Studio 2003 and the Compact Framework V1.0 SP2.

1) With ICMP, when I try to open the socket as follows:

pingSocket = new
System.Net.Socket.Socket(System.Net.Sockets.AddressFamily.InterNetwork,System.Net.Sockets.SocketType.Raw,System.Net.Sockets.ProtocolType.Icmp);

It throws the error “The support for the specified socket type does not
exist in this address family. The Dot Net documentation shows
“System.Net.Sockets.ProtocolType.Icmp†is a valid type for the compact
framework, and this call works fine in the XP environment.

2) With TCP and UDP I can open the Socket and do the Connect but then when I
try to issue the Socket.Send() it throws an error
“System.InvalidOperationExceptionâ€. I was very surprised at this error since
it basically tells me the Socket class does not work in the compact framework.
 
I had the same problem.
2. CF seems to not support synchronous send on a socket set up for
asynchronous operation. Use BeginSend/EndSend method. I havn't seen this
documented except in the newsgroups.

Hope this helps.
Bjorn
 
Back
Top