Socket Programming with C-Mex
Show older comments
Hello,
I'm in need of setting up a TCP/IP connection to a Simulink simulation (which will employ a demodulator). I am using RTW (Simulink Coder) to output C Code and an exe for the demod.
I need to send the data to the generated executable via TCP/IP. I'm currently looking to accomplish this via sockets through a C-Mex implementation with an S-function block.
I have C++ server and client code that compiles (and runs via cmd line - Windows XP 32 bit) but crashes MATLAB upon execution.
Any thoughts as to what may be causing the crashing or better ways to implement this architecture would be greatly appreciated.
Thanks,
Jason
Answers (2)
Ed Laurence
on 5 Nov 2011
0 votes
Hi Jason,
Did you get anywhere with this problem? I've been trying to get something similar working where I've embedded C code for a WinSock client in a level 2 S-function but as soon as I run the simulation Simulink hangs. I've tried debugging by attaching the MEX file to VS 2008 and have found some errors relating to invalid parameters passed to the C function but haven't managed to solve it yet.
Cheers,
Ed
Silmara da Silva Palmieri
on 25 Mar 2019
0 votes
Hi Ed,
Did you get any answer regarding this problem? I am facing the same issue and have no clue how to check where is my problem.
Thank you!
Regards,
Silmara
Categories
Find more on Simulink Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!