I am trying to port an application from Windows to Android that uses datagramsockets for communication. (C# to Java)
In the windows world, I created a messagereceived event listener that is automatically called when a UDP packet is received. The program continues to process data while it is waiting for a message to arrive.
In Android, there does not appear to be a corresponding event listener. All of the samples that I have found use loops to poll for the data and call the blocking datagramsocket.receive method to fetch the packet.
My program can't sit idle as it waits for the UDP packet, it needs to work even if the other end of the UDP system is down.
Can anyone direct me to a resource that can show me how to replicate this process in java on the Android?
Thanks,
Dan
In the windows world, I created a messagereceived event listener that is automatically called when a UDP packet is received. The program continues to process data while it is waiting for a message to arrive.
In Android, there does not appear to be a corresponding event listener. All of the samples that I have found use loops to poll for the data and call the blocking datagramsocket.receive method to fetch the packet.
My program can't sit idle as it waits for the UDP packet, it needs to work even if the other end of the UDP system is down.
Can anyone direct me to a resource that can show me how to replicate this process in java on the Android?
Thanks,
Dan