Currently I'm experimenting with this code (I know it doesn't fit the purpose). I tried sending from 3 sources simultaneously (UDP Test Tool) and it seems ok, but I wan't to know how this would behave if form those 10K possible clients 2K are sending at the same time? The packets are approximately 70 bytes in size. I'm supposed do to some simple operations on the contents and write the results to a database.
public class Test{
public static void main(String [] args){
int PACKETSIZE=1400;
int port=5555;
byte[] bytes = new byte[PACKETSIZE];
//ByteBuffer bb = ByteBuffer.allocate(4);
//Byte lat=null;
try
{
DatagramSocket socket = new DatagramSocket(port);
System.out.println("The server is runing on port " + port +"\n");
while (true)
{
DatagramPacket packet = new DatagramPacket(bytes, bytes.length);
socket.receive(packet);
System.out.println("Packet length = " + packet.getLength());
System.out.println("Sender IP = " + packet.getAddress() + " Port = " + packet.getPort());
for(int i=0; i<=packet.getLength();i++){System.out.print(" "+ packet.getData()[i] + " ");}