我需要将服务器上的文件复制和/或移动到我的另一端 防火墙。我想知道是否有人能告诉我我需要哪个端口 打开在我的C#程序中运行这些方法?
class MoveIt
{
public static void Main()
{
var localPath = @"c:\temp\";
var remotePath = @"\\MyRemoteServer\MyShare\MyPath\"
try
{
if (File.Exists(localPath + "MyTestFile.txt") &&
Directory.Exists(remotePath))
{
File.Move(localPath + "MyTestFile.txt", remotePath +
"MyTestFile.txt");
}
}
catch (Exception e)
{
Console.WriteLine("The process failed: {0}", e.ToString());
}
}
}
答案 0 :(得分:0)
您至少需要 TCP 445 ,并且确定您还需要TCP 137-139,尽管后一组仅在您仍然卡住的情况下使用NetBIOS进行smb名称解析。