测试方法:
public void TestNetWorkConnection()
{
string localpath = "X:";
//int status = NetworkConnection.Connect(@"//192.168.0.2/test", localpath, @"test", "test");
int status = NetworkConnection.Connect("////192.168.0.2//test", localpath, @"test", "test");
if (status == (int)ERROR_ID.ERROR_SUCCESS)
{
FileStream fs = new FileStream(localpath + @"//123.txt", FileMode.OpenOrCreate);
using (StreamWriter stream = new StreamWriter(fs))
{
stream.WriteLine("你好呀,成功了");
stream.Flush();
stream.Close();
}
fs.Close();
}
else
{
Console.WriteLine(status);
}
NetworkConnection.Disconnect(localpath);
}
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持ASPKU。
注:相关教程知识阅读请移步到c#教程频道。










