static void Thread_Bidi_Send_Binary(object context) { var sender = (SimpleBidirectionalByteStream)context; var sx = new XmodemSend(sender); var bytes = new List <byte>(); for (int i = 0; i < size; ++i) { bytes.Add((byte)i); } var result = sx.Send(bytes.ToArray()); }
static void Thread_Net_Send_Binary(object context) { var send_sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP); send_sock.Connect(new IPEndPoint(ip, port)); var sender = new SimpleNetworkStream(send_sock); var sx = new XmodemSend(sender); var bytes = new List <byte>(); for (int i = 0; i < size; ++i) { bytes.Add((byte)i); } var result = sx.Send(bytes.ToArray()); sender.Close(); }