Manage the socket to upload video
Hello everyone.
I would like to know if someone can use the Socket Object to load medium files on a remote server (for example a 10Mb video).
Currently my script manages an FTP connection (passive mode), and through the Socket.write loads files on the server. It works.
The problem is that it is not possible to handle some cases that may occur, such as knowing when the connection has fallen while uploading. Once the socket has started loading, it does not respond to any call, taking up 100% of the CPU. The only stop he encounters is his timeout property.
If the connection drops, and we have a 120sec timeout, the loop continues to run, blocking AfterEffect for two minutes. Any other function is frozen even though there is no more connection. The same AfterEffects does not respond.
Possible solutions to better manage the Socket during an upload?
Thank you.
// Socket
FTP_PASSIVE.encoding = "BINARY";
FTP_PASSIVE.timeout = 120;
// Bytes
video_to_upload.open("r");
video_to_upload.encoding = "BINARY";
DATA = video_to_upload.read(video_filesize);
video_to_upload.close();
// Upload
FTP_PASSIVE.write( DATA );
FTP_PASSIVE.close();