Thanks a lot of help.
The socket is an reference for DatagramSocket, and socket.receive(packet) is an inbuilt method which copies information from the packet which it receives from the network and puts the data in packet along with other information like destination address etc.
The reason why i dont execute retrieving the data in the the other thread is, because as you know in UDP there is no internal buffer, hence as soon as the packet arrives from the network it should be received or there will be a packet loss. Hence if i include the code which retrieves data from list and processes it, a lot of processor power will go into that (as in creation of jpacket there are a lot of algorithms implemented in it according to the data in packet).
So in the mean time iam loosing a lot of data. I actually tried that. That way i was almost loosing 50% of the packets.
PS: I have attached the code
. Please help if you can
In the file. First say 'in' is an instance of SocketInputStream().
in.activate() is called which initiates a new Thread which only collects packets from network and add's it to the list.
Later when in.readData() is called : It removes packets from the list and later does calculation on that.