Timeout when running tcpip in server mode OR how to force fopen to return after a set timeout
6 次查看(过去 30 天)
显示 更早的评论
Hello all,
t = tcpip('localhost',30000,'NetworkRole','server')
fopen(t)
I can then use this connection to send files between Matlab instances (such as me and my lab mate). However, fopen does not return until a connection has been made by someone. While I can ctrl-C to get out of this, you cannot ctrl-C in a deployed application AND this drops us out of the entire program rather than letting us skip this step and move on with other operations. Nominally I would want a connection timeout option for the tcpip object, but there is no such property or method.
So, I can see 3 possible options,
- Run fopen asynchronously so that even if it is sitting there waiting till the dawn of time, the rest of my code can continue to execute.
- Run fopen with some sort of timeout enforced externally during the call (something like FEX timeout, but not using ctrl-C. I just want to force the fopen command to return after a reasonable period).
- Modify tcpip itself to allow for a timeout.
The middle is my favorite, since I can use that for other code. Any ideas?
-DP
1 个评论
Darshan Vijayaraghavan
2020-6-4
Can you explain on how or elaborate more on the 2nd point that you mentioned above?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!