0
我有一個服務器客戶端程序在VS2010中使用C#,其中客戶端正在向服務器發送文件,服務器用另一個文件響應客戶端。我要的是讓我的服務器去爲我使用功能如何識別客戶端是否使用VS2010中的C#發送文件到服務器?
IPAddress[] ipAddress = Dns.GetHostAddresses("MRD044");
for (int i = 0; i < ipAddress.Length; i++)
{
if (ipAddress[i].AddressFamily == AddressFamily.InterNetwork)
{
ipEnd = new IPEndPoint(ipAddress[i], 5656);
sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
sock.Bind(ipEnd);
}
}
curMsg = "Starting...";
Console.WriteLine(curMsg);
sock.Listen(10);
curMsg = "Running and waiting to receive file.";
現在我想運行的執行服務器端的接收功能的GetFile()函數,只有當客戶端發送運行文件到服務器。像:
if(clientSendingFile())
{
getFile();
}
else
{}
你的代碼如何在服務器上運行?在IIS內?或作爲獨立的exe?無論如何,谷歌的「客戶端服務器C#」,你會被設置。 – Marcel
你可能想澄清你的問題在那裏,但看起來你正在尋找關於編寫客戶端服務器程序從主機接收文件的主題的教程。繼承人之一: '[網站]:'http://socketprogramming.blogspot.co.uk/2010/01/send-file-from-server-to-client-using-c.html –
不,不!沒有像MR那樣。約翰福克納休息我完成了它。感謝您的評論 – Rahul