Timeout when running tcpip in server mode OR how to force fopen to return after a set timeout
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Darshan Vijayaraghavan
le 4 Juin 2020
Can you explain on how or elaborate more on the 2nd point that you mentioned above?
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!