- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要将文件从计算机发送到嵌入式服务器,并出于测试目的将输出发送到 super 终端以查看收到的内容。如果我们在计算机上查看 F12 开发工具“网络”,正文通常是正确的,但有时第 3 行与第 2 行重复。在服务器端,接收到的行在整个传输中重复。出于测试目的,这是文件:
$A80000032W18%L6C3100D8
$A8000009EW18%LC31600D8
$A8000010AW18%LC31600D8
$A80000176W18%L532F00D8
$A800001E2W18%L22A200D8
$A800002BAW18%L393700D8
$A80000326W18%LE77600D8
$A80000392W18%L5E1900D8
$A800003FEW18%L488600D8
$A8000046AW18%LC77300D8
$A800004D6W18%L904500D8
$A80000542W18%L9F1800D8
$A800005AEW18%L76D400D8
$AEND
有什么建议吗?此传输适用于 Chrome 和 Firefox,但不适用于 IE 和 Edge。
最佳答案
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>MS-Sedco Intersector Server</title>
<link href="toplevel.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form name=connect >
<pre>
<input id="ConnType" type="submit" name=misce onclick="connecting()" value="Connect to Radar" size="2">
<input id="ConnStatus" type="hidden" name=Conn value="*DA;" size="2">
</pre>
</form>
<pre>
<input type="file" onchange='readText(this)' size="2">
</pre>
<pre>
<input type="button" onclick="program_boot()" value="Program" size="2">
</pre>
<pre>
<div id=BootStatus> </div> <div id=BootAddress> </div> <div id=b_test> </div>
</pre>
<form name=RTimeout>
<input type="hidden" name=misce value="RTimeout" size="2">
</form>
<form id="ie-fix" name="ie-fix" action="RadarBootLoader.htm" method="POST" target="booter-loader">
<input type="hidden" id="dataIE" name="" />
</form>
<iframe src="" id="boot-loader" name="boot-loader" style="display:none" width="100%" height="600"></iframe>
</body>
<script language="JavaScript">
//////////////////////////////////////////////////////////////////////////////////////
// Variables global to script
//////////////////////////////////////////////////////////////////////////////////////
var Temp_id;
var txt;
var etime;
var index;
var bootindex;
var output;
var address;
var done = 0;
var lastlineindex;
var prog_state = 0;
var sendout;
var reader = new FileReader();
var interval;
if ( document.getElementById("ConnStatus").value == 1 )
{
document.getElementById('BootStatus').innerHTML= " Radar Boot Connected";
}
function readText(that){
if(that.files && that.files[0]){
reader.onload = function (e) {
output=e.target.result;
//process text to show only lines with "@":
//output=output.split("\n").filter(/./.test, /\@/).join("\n");
output=output.split("\n")
document.getElementById('BootStatus').innerHTML= output;
sendout = output[0];
};//end onload()
reader.readAsText(that.files[0]);
}//end if html5 filelist support
}
function alertContents(httpRequest){
if (httpRequest.readyState == 4){
// everything is good, the response is received
if ((httpRequest.status == 200) || (httpRequest.status == 0)){
txt = httpRequest.responseText;
document.getElementById('BootStatus').innerHTML = httpRequest.responseText;
if ( (httpRequest.responseText).indexOf("Load Complete") > -1 )
{
prog_state = 0;
if ( done )
{
//done = 0;
//bootindex = 0;
clearInterval(etime);
document.getElementById('BootStatus').innerHTML = " Program Finished !!!";
}
else
{
//clearInterval(etime);
//etime = setTimeout( "timeout()", 1);
//document.getElementById('BootStatus').innerHTML = " Program Radar Flash Memory";
bootindex++;
sendout = output[bootindex];
if ( (output[bootindex]).indexOf("END") > -1)
{
done = 1;
}
else if ( (output[bootindex]).indexOf("$A") > -1)
{
address = "0x" + (output[bootindex]).substr(2, 8);
document.getElementById('BootAddress').innerHTML= " " + address;
}
//console.log(sendout);
if (window.XMLHttpRequest) {
send_with_ajax('RadarBootLoader.htm');
} else {
// Here is the IE fix test code
var iframe = document.getElementById("boot-loader");
var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
document.getElementById("dataIE").value = sendout;
document.getElementById("ie-fix").submit();
interval = setInterval(iframe_loaded, 2000);
}
}
}
//alert(bootindex);
//alert( "The response was: " + httpRequest.status + httpRequest.responseText);
//alert( (httpRequest.responseText).indexOf("bindex") );
//alert(document.getElementById("BootInd").value);
}else{
alert('There was a problem with the request. ' + httpRequest.status + httpRequest.responseText);
}
}
}
function iframe_loaded() {
var iframe = document.getElementById("boot-loader");
var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
var httpRequest = {
readyState: 4,
status: 200,
responseText: "Load Complete"
};
console.log(iframeDoc.readyState);
if (iframeDoc.readyState == "complete") {
clearInterval(interval);
alertContents(httpRequest);
}
}
function send_with_ajax(url)
{
var http_request = false;
if (window.XMLHttpRequest)
{ // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType)
{
//http_request.overrideMimeType('text/xml');
}
}
else if (window.ActiveXObject)
{ // IE
try {
http_request = new ActiveXObject("text/xml");
}
catch(e){
try
{
http_request = new ActiveXObject("text/xml");
}
catch (e)
{
try
{
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {}
}
}
}
if (!http_request)
{
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
document.getElementById('b_test').innerHTML = bootindex;
if (window.XMLHttpRequest) {
http_request.onreadystatechange = function() { alertContents(http_request); };
http_request.open('POST', url, true);
http_request.setRequestHeader('Content-type', 'multipart/form-data');
http_request.setRequestHeader('Content-Encoding', "gzip");
http_request.send(sendout);
} else {
iframe_loaded();
}
}
function connecting()
{
document.getElementById('BootStatus').innerHTML= " Connecting Radar Boot Loader";
}
function program_boot()
{
document.getElementById('BootStatus').innerHTML= " Waiting Radar Echo";
etime = setTimeout( "timeout()", 10000);
prog_state = 1;
send_with_ajax('RadarBootLoader.htm');
}
function timeout()
{
if ( prog_state == 1 )
{
done = 0;
bootindex = 0;
alert("Can not Program Flash Memory !!");
document.getElementById('BootStatus').innerHTML= " ";
clearInterval(etime);
document.RTimeout.submit();
}
/*else
{
clearInterval(etime);
send_with_ajax('RadarBootLoader.htm');
document.getElementById('b_test').innerHTML = bootindex;
//etime = setTimeout( "timeout()", 10);
}*/
}
//////////////////////////////////////////////////////////////////////////////////////
// Infinite loop with delay
//////////////////////////////////////////////////////////////////////////////////////
function loop()
{
bootindex = 0;
}
//////////////////////////////////////////////////////////////////////////////////////
// Run
//////////////////////////////////////////////////////////////////////////////////////
window.onload=loop;
</script>
</html>
关于javascript - 使用 Post 或 iframe 时,Internet Explorer 文件传输接收到的行重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42307773/
我一直在做一些关于测量数据传输延迟的实验 CPU->GPU 和 GPU->CPU。我发现对于特定消息大小,CPU->GPU 数据传输速率几乎是 GPU->CPU 传输速率的两倍。谁能解释我为什么会这样
我将 ElasticSearch 用作我的 Post 模型的 Rails pet 项目应用程序的全文引擎。在我的 posts_controller.rb 索引操作中: def index
概述 流经网络的数据总是具有相同的类型:字节,这些字节如何传输主要取决于我们所说的网络传输。用户并不关心传输的细节,只在乎字节是否被可靠地发送和接收 如果使用 Java 网络编程,你会发现,某些时候当
我正在编写一些代码,以便将共享点从该页面转移到另一个页面: Server.Transfer("/DefectManagement/DefectList/default.aspx") 但是我遇到了这个问
我有这个泄漏,任何猜测?这个类有一些奇怪的引用。我的代码的任何地方都没有 contentobserver In com.example:1.5.0:27. com.example.ui.record
我听说过点对点内存传输并阅读了一些关于它的内容,但无法真正理解与标准 PCI-E 总线传输相比它的速度有多快。 我有一个使用多个 GPU 的 CUDA 应用程序,我可能对 P2P 传输感兴趣。我的问题
ftping 文件时,Transmit 中是否有忽略或过滤器列表?我希望它忽略上传 .svn 文件等。 最佳答案 是的。转到首选项并选择 Rules标签。在那里您可以定义要跳过哪些文件的规则。实际上,
我有以下片段来生成声音,在 while 循环中,我想动态更改它,以便它在声音生成期间创建不同频率的声音。 for(uint16_t i = 0; i < sample_N; i++) { da
我正在尝试使用 Delphi 2010 和 Indy 对 Web 服务进行概念验证。我此时的代码是: procedure TForm1.Log(const sEvent, sMsg: String);
我有一个 ActiveMQ JMS 代理,在端口 61616 上使用默认的 openwire TCP 传输公开。 我有许多远程客户端可以绑定(bind)到此代理来监听他们的消息。 如果我想打开 kee
reconnection strategies文档仅使用 JMS 示例,但是 FTP transport documentation确实说明了重新连接策略的使用,但没有任何细节或示例。 进一步,如果你
我有 2 个 TreeView,第一个填充有项目。 try { CheckBoxTreeItem treeRoot = new CheckBoxTreeItem("Root"); tr
在我为学校开发的一个网站上,用户输入他们的学校电子邮件和密码,如果他们已注册,则登录。如果没有,则会显示登录的第二部分,要求输入笔名称并确认密码。正因为如此,以及我复杂的业余 Django 编程,我有
我正在开发一个 Web 服务,我们在其中使用 LINQ-to-SQL 进行数据库抽象。当客户使用我们的网络服务时,对象被序列化为 XML,一切都很好。 现在我们希望开发我们自己的使用本地数据类型的客户
我应该创建一个名为“Backwards”的方法,该方法将列表从尾部横向到头部,但是当我运行代码时,它出现说(第 88 行)它找不到光标 = cusor.prev;象征。我需要在循环中再次设置上一个链接
给定像 Uint8Array 这样的类型化数组,似乎有两种方法可以通过 worker 传输它们。 选项 1 直接发送缓冲区并在接收端进行转换: 发件人:postMessage({fooBuffer:
在 PHP + jQuery 环境中,我和我的 friend 无法得出最佳解决方案。我们正在使用 Ajax 从数据库中获取数据。 解决方案 1 - Ajax 应该只传输数据,而不是 HTML 好处:我
大家好,非常感谢您的宝贵时间。 有一个 std::stringstream 需要传输到远程机器。网络库允许我用以下方法构建数据包: CreatePacket( const void * DATA, s
我正在使用 libcurl 通过 FTP 传输二进制文件 (.exe),并将其保存到本地文件。问题是文件传输后,它已被更改,不再是有效的 Win32 应用程序,因此无法运行。这是我的做法: CURL
各位程序员, 当我将它上传到我的 FTP 时,我的网站出现此错误:资源被解释为样式表,但使用 MIME 类型文本/纯文本传输 BlahBlahi
我是一名优秀的程序员,十分优秀!