// 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.Sockets; using System.Text; namespace E { public class Client { public static void Main(string[] args) { TcpClient cli = new TcpClient("localhost", 1234); Stream stm = cli.GetStream(); BinaryWriter br = new BinaryWriter(stm); br.Write("Nu kommer der 2 pakker af henholdvis 5 og 7 bytes"); br.Write(5); br.Write(new byte[] { 1, 2, 3, 4, 5 }); br.Write(7); br.Write(new byte[] { 6, 7, 8, 9, 10, 11, 12}); br.Close(); stm.Close(); cli.Close(); } } }