Salut,
je veux envoyer un fichier d'une machine à une autre dans un reseau local en utilisant la classe Socket.sendFile mais ça marche pas
voici la partie du code concernant l'envoie du fichier
merci de m'aidez.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 IPHostEntry ipHost = Dns.GetHostEntry(Dns.GetHostName()); IPAddress ipAddr = ipHost.AddressList[0]; IPEndPoint ipEndPoint = new IPEndPoint(ipAddr, 35); Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); client.Connect(ipEndPoint); string fileName = "C:\\test.txt"; Console.WriteLine("Sending {0} to the host.", fileName); client.SendFile(fileName); client.Shutdown(SocketShutdown.Both); client.Close();
Partager