comment envoyer un socket C# code example
Example: comment envoyer un socket C#
IPHostEntry ipHost = Dns.GetHostEntry(Dns.GetHostName());
IPAddress ipAddr = ipHost.AddressList[0];
IPEndPoint ipEndPoint = new IPEndPoint(ipAddr, 11000);
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();