     1function t = testUDP()
     2
     3
     4import java.io.*
     5import java.net.DatagramSocket
     6import java.net.DatagramPacket
     7import java.net.InetAddress
     8tic
     9t.packet = 0;
    10t.send = 0;
    11addr = InetAddress.getByName('192.168.1.50');
    12for i = 1:640
    13    if i < 10
    14        col ='00'+int2str(i);
    15    elseif i <100
    16        col ='0'+int2str(i);
    17    else
    18        col = int2str(i);
    19    end
    20    for j = 1:4
    21        RGBT = ['R','G','B','T'];
    22
    23        mssg = int8(['C',col,RGBT(j),uint8('FUck this shit satsa asdasdasdsadjaskdjkb sadbasjbdsbdkjsakjdbkasjbdkjasbdkjsabdaskbdkjasbdkjasbkjdbaskjdbkjas dbaskd')]);
    24
    25            start = toc;
    26            packet = DatagramPacket(mssg, length(mssg), addr, 8888);
    27            t.packet = t.packet + toc - start;
    28            if i==1 && j==1
    29                socket = DatagramSocket;
    30                socket.setReuseAddress(1);
    31            end
    32            start = toc;
    33            socket.send(packet);
    34            t.send = t.send + toc-start;
    35
    36
    37            error('%s.m--Failed to send UDP packet.\nJava error message follows:\n%s',mfilename,sendPacketError.message);
    38
    39        end % try
    40    end
    41
    42socket.close;
    43toc
    44t.packet
    45t.send
    46end