public void Connect(IPAddress address, int port) { client = new TcpClient(); lock (client) { client.Connect(address, port); stream = client.GetStream(); stream.Write(StringBitConverter.GetBytes(LocalName, sizeof(char) * 128), 0, sizeof(char) * 128); } }
public static void Serialize(Stream target, SignedStroke stroke) { byte[] ownerBytes = StringBitConverter.GetBytes(stroke.Owner, OWNER_NAME_BYTES_ARRAY_LENGTH); target.Write(ownerBytes, 0, ownerBytes.Length); target.Write(BitConverter.GetBytes(stroke.Id), 0, sizeof(Int32)); Serialize(target, stroke.DrawingAttributes); StylusPointCollection points = stroke.StylusPoints; target.Write(BitConverter.GetBytes(points.Count), 0, sizeof(Int32)); foreach (StylusPoint point in points) { Serialize(target, point); } }