// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and 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(); } }