UDP Send from Simulink to Java
조회 수: 3 (최근 30일)
이전 댓글 표시
I'm trying to make a very simple Simulink model which exports the current simulation time from Simulink to Java client code through UDP. However, my Java client is throwing a timeout exception and I can't figure out why. Does anyone have any suggestions?

try {
DatagramSocket udp = new DatagramSocket(16180);
udp.setSoTimeout(20000);
byte[] buffer = new byte[65507];
DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
for (int x = 0; x < 10; x++) {
udp.receive(packet);
String s = new String(buffer, 0, packet.getLength());
System.out.println(s);
}
udp.close();
} catch (Exception e) {
e.printStackTrace();
}
댓글 수: 1
Hari Krishna Ravuri
2019년 7월 31일
편집: Hari Krishna Ravuri
2019년 7월 31일
Hi,
Can you please provide the full stack trace of the Exception thrown by your Java program
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Java Client Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!