// Collection of code snippets by Arne Vajhøj // posted to eksperten.dk, usenet and other places (2002-now) using System; using System.IO; using System.Net; using System.Net.Sockets; public class Client { public static void Main(string[] args) { TcpClient cli = new TcpClient("localhost", 1234); Stream nstm = cli.GetStream(); Stream fstm = new FileStream(@"C:\z.1", FileMode.Open, FileAccess.Read); byte[] b = new byte[10000]; int n; while((n = fstm.Read(b, 0, b.Length)) > 0) { nstm.Write(b, 0, n); } nstm.Close(); fstm.Close(); cli.Close(); } }