我一直在尝试使用C#中的tftp传输文件。 我用Process类实现了它。 我已经在Windows中打开了TFTP客户端功能。
这是命令-
C:\Users\Desktop>tftp -i 192.168.43.171 put
"C:\Users\cc\callisto\SampleTool\src\SampleTool\bin\Debug\DecryptedFiles\dserc.bin"
Transfer successful: 32 bytes in 1 second(s), 32 bytes/s
当我手动执行转移时,转移成功 但是当我通过代码尝试时,它说它未被识别-
'tftp' is not recognized as an internal or external command,
operable program or batch file.
这是我的代码
public static void ExecuteCommand(string fileName, string command)
{
try
{
Process process = new Process();
process.StartInfo.FileName = fileName;//cmd.exe
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.Start();
process.StandardInput.WriteLine(command);//tftp command
process.StandardInput.Flush();
process.StandardInput.Close();
process.WaitForExit();
}
catch (Exception ex)
{ }
}
我要面对的确切问题是什么?谁能帮忙
谢谢。
答案 0 :(得分:0)
因此,经过如此复杂的操作,我发现了此链接[https://github.com/Callisto82/tftp.net/blob/master/Tftp.Net.SampleClient/Program.cs]
我能够成功传输文件,没有任何问题。 希望这会有所帮助