Most efficient UDP receive method?
10 views (last 30 days)
Show older comments
I am trying to received radar video (UDP multicast) directly into MATLAB. I initially tried utilising the udp receive functionality within the instrument control toolbox combined with an external C# program that twisted the multicast packets into broadcast (since the instrument control toolbox does not support multicast). This dropped large amounts of packets at data rates over ~10mbit/s.
I next tried utilising a java multicast socket using the script below:
function [Data] = MatlabMulticastCapture(PacketsToCapture,PacketLength,IP,Port)
%Load java library
import java.io.*
import java.net.*
%Define output array for speed and reduced memory useage
Data=zeros(PacketsToCapture,PacketLength,'int8');
%Initiate socket
socket=java.net.MulticastSocket(Port);
%Increase receive buffer s
socket.setReceiveBufferSize(25*1024^2);
socket=java.net.MulticastSocket(Port);
socket.joinGroup(java.net.InetAddress.getByName(IP));
socket.setReuseAddress(1);
packet=java.net.DatagramPacket(zeros(1,PacketLength,'int8'),PacketLength);
for ii=1:PacketsToCapture
socket.receive(packet);
Data(ii,1:PacketLength)=packet.getData;
end
socket.close
end
This works and does not drop any packets to a data rate of approximately 50mbits/s and does not require any external programs so is a big step forward.
I need to receive data at a rate of 110mbit/s without dropping packets (this is perfectly achievable in Wireshark so is an implementation issue rather than an underlying network issue).
Does anyone have any suggestions either for how to improve performance of the java UDP receive or any alternative methods which may prove more efficient. Each packet contains 1440 bytes of data and they are sent at a constant rate.
Many thanks.
0 Comments
Answers (0)
See Also
Categories
Find more on Web Services in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!