About the MATLAB Web Server
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tik Ho HUI
el 5 de Oct. de 2024
Respondida: Rushikesh
el 8 de Oct. de 2024
I am installing the MATLAB Web Server ( https://ww2.mathworks.cn/matlabcentral/fileexchange/29027-web-server ) and tried the upload page.
However, it loops for a long time without anything come out ! May I ask what happened on the sever and how could it be solved ??
0 comentarios
Respuesta aceptada
Rushikesh
el 8 de Oct. de 2024
Hello,
When using the MATLAB Web Server File Exchange, you may encounter an issue where the upload page seems to be stuck in a long, unending loop. This problem typically arises due to the way the File Exchange handles larger files. While it performs well with smaller files, such as those under 100 KB, larger files can cause delays. Let's explore why this happens and how you can address it:
1. The “JavaTcpServer” function processes incoming data in chunks. For larger files, this results in more iterations of the loop, thereby increasing the time required to read the entire file. Currently, the buffer used for reading data is fixed at a size of 1 MB, as shown in the code snippet below:
data = zeros(1, 1000000, 'int8'); %Increase buffer size
This buffer size may limit the amount of data read in each iteration, but the loop will continue until all data is received. To handle larger files more efficiently, I recommend increasing the buffer size based on the file size.
2. In the “upload.m” file, there is a line of code that converts images to grayscale, which adds additional processing overhead. If this conversion is not necessary for your application, consider commenting out this line to reduce processing time. Here’s a snippet illustrating how you can do this:
function html=uploadshow(headers,config)
filename_in=headers.Content.imagefile.Filename;
filename_in_html=filename_in(length(config.www_folder)+2:end)
%....rest all comment to avoid converting gray image overhead
%Change “filename_out_html” with “filename_in_html” in ‘img src’ as shown below:
html=[html '<img src="../' filename_in_html '" alt="Uploaded image"/> <br>'];
I hope this helps.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre MATLAB Web App Server en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!