Unable to use UDP when using a standalone executable

2 ビュー (過去 30 日間)
Josiah Renfree
Josiah Renfree 2022 年 10 月 12 日
コメント済み: Eric Delgado 2022 年 11 月 4 日
I have a Matlab App which communicates with external software via UDP packets. The program works fine when I run the app through Matlab. However, if I convert the app to a standalone executable and run it via MCR, I get an error regarding UDP comms. I suspected it was due to a firewall, but I completely disabled the firewall on both machines and still get the error.
Any suggestions?

採用された回答

Eric Delgado
Eric Delgado 2022 年 10 月 12 日
Firewall. No doubt about it! :)
Just add your app (not Matlab, but your deployed app) in "white list" of the firewall. See image below.
  2 件のコメント
Josiah Renfree
Josiah Renfree 2022 年 11 月 4 日
So this indeed was a necessary step, but it wasn't entirely causing the issue I was having (I had previously tried this step to no avail).
The other issue I had is that when a standalone executable runs, the 'working directory' is not necessarily the directory where the application is installed. I believe the working directory is "C:\Windows\System32" instead of, for examples, "C:\Program Files\Matlab_app". Moreover, my application requires reading and writing to a text file, and not only was I trying to read/write from the wrong directory, but I also didn't have write privileges to "C:\Windows\System32".
In addition to adding a firewall exemption to the application as described above, my solution involved changing my Matlab application to reading/writing to a hard-coded directory in "C:\ProgramData", so that I had write privileges and wasn't relying on the 'pwd' command.
Thanks!
Eric Delgado
Eric Delgado 2022 年 11 月 4 日
Hummmm... don't forget to create an property that hold the path of your app... app.RootFolder, for example.
if isdeployed
[~, result] = system('path');
app.RootFolder = char(regexpi(result, 'Path=(.*?);', 'tokens', 'once'));
end
And install your app in a location that you have write pivilegies.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeManage Products についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by