H
Houston Keach
I seem to be having all sorts of problems with UDP that I don't
encounter with TCP. I realize that ActiveSync doesn't pass UDP
packets but it seems that the following scenarios should work.
1. I started out with the UdpClient class, intending just to quickly
test connectivity. Can't get the simplest code to work:
System.Net.Sockets.UdpClient udpListener = new UdpClient();
if(udpListener == null) return ;
IPEndPoint remoteEndPoint = new IPEndPoint( IPAddress.Any, 6681);
byte[] recvBytes = udpListener.Receive(ref remoteEndPoint);
string returnData = System.Text.Encoding.ASCII.GetString(recvBytes, 0,
recvBytes.Length);
On the call to Receive I get this exception:
An unhandled exception of type 'System.Net.Sockets.SocketException'
occurred in system.dll
Additional information: An invalid argument was supplied.
2. I gave up on the UdpClient and used the Socket class. Code that
works great in the full framework, executes on the device but doesn't
seem to get any packets. Clients trying to send packets to the UDP
port report that it's not open. When I run it in the emulator,
netstat doesn't show the port being open. Is it even possible to
receive UDP datagrams through the emulator?
3. Gave up on the emulator and tried to test on the device using the
wireless network. Connectivity is good but, again, no UDP packets! I
can send but not receive. Clients don't think there is an open port.
Hoping someone can offer some advice. Thanks in advance.
--Houston Keach
encounter with TCP. I realize that ActiveSync doesn't pass UDP
packets but it seems that the following scenarios should work.
1. I started out with the UdpClient class, intending just to quickly
test connectivity. Can't get the simplest code to work:
System.Net.Sockets.UdpClient udpListener = new UdpClient();
if(udpListener == null) return ;
IPEndPoint remoteEndPoint = new IPEndPoint( IPAddress.Any, 6681);
byte[] recvBytes = udpListener.Receive(ref remoteEndPoint);
string returnData = System.Text.Encoding.ASCII.GetString(recvBytes, 0,
recvBytes.Length);
On the call to Receive I get this exception:
An unhandled exception of type 'System.Net.Sockets.SocketException'
occurred in system.dll
Additional information: An invalid argument was supplied.
2. I gave up on the UdpClient and used the Socket class. Code that
works great in the full framework, executes on the device but doesn't
seem to get any packets. Clients trying to send packets to the UDP
port report that it's not open. When I run it in the emulator,
netstat doesn't show the port being open. Is it even possible to
receive UDP datagrams through the emulator?
3. Gave up on the emulator and tried to test on the device using the
wireless network. Connectivity is good but, again, no UDP packets! I
can send but not receive. Clients don't think there is an open port.
Hoping someone can offer some advice. Thanks in advance.
--Houston Keach