当我的数据来自文本文件时,表单提交停止
我正在托管Web服务器的自定义STM32F7上开发一个应用程序。我的任务是从此Web服务器更新应用程序:通过选择.bin文件并单击简单的按钮。目的是在内存中写入此文件,然后触发将移动向量表并执行必要的初始化的引导加载程序。除了在内存中编写文件的一部分外,一切都是功能性的。 我在JavaScript中开发了这一部分,并且想发送一系列的POST请求,因为在C处理方面,我无法收到很大的数据。我的文件具有此类类型的20000多行: 1111 2222 3333 4444 5555 6666 7777 8888 \ n 1111 2222 3333 4444 5555 6666 7777 8888 \ n ...
当我的数据是我在“ ...”之间手动输入的示例值时,我可以发送任意数量的帖子请求(请参阅“ for for loop the the Loins in Remans中”)。但是就我而言,我想通过30行数据发送30行。我设法发送了这些数据,但是随机时间后(可能是在发送20或200个请求之后),未发送请求,并且我的Web服务器会冻结。 我的代码不是很清楚,我向您发布了我遇到问题的功能。要用“隐藏”的数据依次提交我的表单,我使用setInterval()。
function cut(){
document.getElementById('mydata_file').value = "";
pas = pas + 30;
for (let k = pas; k < pas+30; k++) {
tab[k] = fich.slice(0+k*41, 41+k*41);
document.getElementById('mydata_file').value += tab[k];
//document.getElementById('mydata_file').value += "AAAA ";
}
}
function send_form(){
document.getElementById("myForm").submit();
}
该程序几乎是实用的,您对我有什么建议吗?
I am developing an application on a custom STM32f7 that hosts a web server. My task is to update the application from this web server: by selecting a .bin file and clicking on a simple button. The objective is to write this file in the memory and then to trigger the bootloader which will move the vector table and perform the necessary init. Everything is functional except the part of writing the file in the memory.
I develop this part in javascript and I want to send a succession of POST requests since on the c processing side, I can't receive very large data. My file has more than 20000 lines of this type:
1111 2222 3333 4444 5555 6666 7777 8888\n
1111 2222 3333 4444 5555 6666 7777 8888\n
...
When my data are example values that I enter manually between "..." I can send as many POST requests as I want (see in the for loop the line in comment). But in my case I want to send 30 lines by 30 lines of data. I manage to send this data but after a random time (it may be after 20 or 200 requests sent), the requests are not sent and my web server freezes.
My code is not very clear, I post you the function on which I meet my problem. To submit my form successively with a data "hidden" I use setInterval().
function cut(){
document.getElementById('mydata_file').value = "";
pas = pas + 30;
for (let k = pas; k < pas+30; k++) {
tab[k] = fich.slice(0+k*41, 41+k*41);
document.getElementById('mydata_file').value += tab[k];
//document.getElementById('mydata_file').value += "AAAA ";
}
}
function send_form(){
document.getElementById("myForm").submit();
}
The program is almost functional, do you have any suggestions for me ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论