UDP Send from Simulink to Java

8 ビュー (過去 30 日間)
Shiloh Greer
Shiloh Greer 2019 年 7 月 18 日
編集済み: Hari Krishna Ravuri 2019 年 7 月 31 日
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
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 ExchangeInterface-Based Instrument Communication についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by