如何使用kermit协议在串行端口上写入文件 [英] how to write a file on serial port using kermit protocol

查看:114
本文介绍了如何使用kermit协议在串行端口上写入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友

i不知道如何使用kermit protocol.i有三个txt文件a,b,c我希望用Linux串口通讯在linux设备上写这些文件,问题是这些文件必须写成使用kermit协议,我不知道如何在我的c#应用程序中使用它

我的书面函数是........

Hello friends
i don't know how to use kermit protocol.i have three txt file a,b,c and i want to write these file on linux device by using serial communication ,problem is that these file has to be written to use of kermit protocol and i don't know how to use it in my c# application
my written function is........

public void Fun_SendFile(string path, string filename)
       {




port.DiscardInBuffer();
            Thread.Sleep(100);
            port.DiscardOutBuffer();
            Thread.Sleep(1000);
            string removefile = "rm" + " " + filename.ToLower();
            Fun_SendCommand(removefile.Trim());
            Thread.Sleep(1000);
            Fun_SendCommand("ls".Trim());
            Thread.Sleep(100);
            StreamReader readtext = new StreamReader(path);
            contents = "echo" + " " + '*';
            contents = contents + readtext.ReadToEnd() + '*' + ">>" + " ";
            contents = contents + filename.ToLower();
            contents = contents.Replace('*', '"');//.Replace('2','"');          
            contents = contents.Replace("\r", "").Replace("\n", "");
            byte[] bt = Encoding.UTF8.GetBytes(contents);
            port.Write(bt, 0, bt.Length);         
}  

推荐答案

参见 https://www.google.com/search?q=kermit+protocol [ ^ ]。


这篇关于如何使用kermit协议在串行端口上写入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆