How do I create a UDP Server in Simulink?

2 Ansichten (letzte 30 Tage)
Nathan Hardenberg
Nathan Hardenberg am 29 Mai 2021
Bearbeitet: Nathan Hardenberg am 28 Okt. 2021
Question
I'm trying to create an UDP-Server with Simulink. I found many differend UDP-Send and UDP-Receive/UDP-Read Blocks in Simulink but none of them could extract the ip adress and port from the client. (In my case the IP-adress is not the problem since it's static)
Normally an UDP-Server receives data from a client and extracts the client ip and port from the header and sends back data to that client (That's what I want to do!). Since I don't know how to extract the client ip and port I am not able to send data back to the client.
Does anyone know of a way to create such UDP-Server?
Dataflow
I have C++ code which is sending the data to Simulink and waits for an answer. After reciving the answer the C++ code send new data.
Other
I tested the C++ Code with a Matlab UDP-Server i wrote using udpport(). This works fine.
Maybe also related to this Question (not answered yet)

Akzeptierte Antwort

Nathan Hardenberg
Nathan Hardenberg am 28 Okt. 2021
Bearbeitet: Nathan Hardenberg am 28 Okt. 2021
At the moment (28.10.2021) Simulink has no functionality to read out sender/client ip and port. I got this functionality with a self written S-Functions, which runs C++ Code (one for sending and one for receiving). My solution is written for Windows so it is OS dependent, but it works. Not the solution I wanted, but the solution I came up with.

Weitere Antworten (0)

Kategorien

Mehr zu Block Libraries finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by