Assume that a transmitter is sending DatagramPacket at random intervals. Is there a way to know when a packet is received at the receiver?
In C++ and using QT it is possible to connect
the socket to a readyRead()
signal for example:
connect(udpSocket, SIGNAL(readyRead()), this, SLOT(processPendingDatagrams()));
Then everytime a packet is arraived at receiver a SIGNAL
is emitted and we jump to processPendingDatagrams()
routine.
Is it possible to do something similar in Android? If not what is the best way to read received packets as soon as they arrive?