G
Guest
I'm new to the Compact Framework and C# but have been programming for
years, but not on small devices.
I have written a program running on Dell Axim that receives UDP packets.
that was converted from java using the tool provided by Microsoft. It
creates a TextBox to display messages (like "packet received" etc) and a
button. When the button is pressed the program listens for UDP packets
on port 51800.
On my desktop PC I then run a program that creates packets and sends
them to the proper IP address/port. Early in my learning process I
learned that I needed to disconnect the Axim from the cradle and use the
wireless network for receiving network traffic. I *DO* receive some of
the UDP packets, so my problem is not that I can't receive any data ---
my problem is that delivery seems unreliable even by UDP standards.
Out of 100 packets (each 10 bytes) sent (with a delay of 500 or 1000 ms
between packets) my program receives 10-12 of them. I also tried 256
byte packets and 1024 with similar disappointing results.
Is this normal on these little devices? Am I expecting too much? I
know that UDP is not guaranteed but this seems so bad that I can only
assume my program is flawed.
I can provide more code if needed. A UdpClient is used to receive the
data. Here's the receive method if that helps.
THANKS!
public static void Receive(System.Net.Sockets.UdpClient tempClient,
out PacketSupport packet)
{
System.Net.IPEndPoint remoteIpEndPoint =
new System.Net.IPEndPoint(System.Net.IPAddress.Any, 0);
PacketSupport tempPacket;
try
{
byte[] data_in = tempClient.Receive(ref remoteIpEndPoint);
tempPacket = new PacketSupport(data_in, data_in.Length);
tempPacket.IPEndPoint = remoteIpEndPoint;
}
catch ( System.Exception e )
{
throw new System.Exception(e.Message);
}
packet = tempPacket;
}
years, but not on small devices.
I have written a program running on Dell Axim that receives UDP packets.
that was converted from java using the tool provided by Microsoft. It
creates a TextBox to display messages (like "packet received" etc) and a
button. When the button is pressed the program listens for UDP packets
on port 51800.
On my desktop PC I then run a program that creates packets and sends
them to the proper IP address/port. Early in my learning process I
learned that I needed to disconnect the Axim from the cradle and use the
wireless network for receiving network traffic. I *DO* receive some of
the UDP packets, so my problem is not that I can't receive any data ---
my problem is that delivery seems unreliable even by UDP standards.
Out of 100 packets (each 10 bytes) sent (with a delay of 500 or 1000 ms
between packets) my program receives 10-12 of them. I also tried 256
byte packets and 1024 with similar disappointing results.
Is this normal on these little devices? Am I expecting too much? I
know that UDP is not guaranteed but this seems so bad that I can only
assume my program is flawed.
I can provide more code if needed. A UdpClient is used to receive the
data. Here's the receive method if that helps.
THANKS!
public static void Receive(System.Net.Sockets.UdpClient tempClient,
out PacketSupport packet)
{
System.Net.IPEndPoint remoteIpEndPoint =
new System.Net.IPEndPoint(System.Net.IPAddress.Any, 0);
PacketSupport tempPacket;
try
{
byte[] data_in = tempClient.Receive(ref remoteIpEndPoint);
tempPacket = new PacketSupport(data_in, data_in.Length);
tempPacket.IPEndPoint = remoteIpEndPoint;
}
catch ( System.Exception e )
{
throw new System.Exception(e.Message);
}
packet = tempPacket;
}