public void SendFile(String fileName) { DeveOutgoingMessage msg = new DeveOutgoingMessage(DeveMessageType.Data); msg.WriteString("file"); using (FileStream read = new FileStream(fileName, FileMode.Open)) { msg.WriteString(Path.GetFileName(fileName)); msg.WriteInt32((int)read.Length); byte[] b = new byte[read.Length]; read.Read(b, 0, (int)read.Length); msg.WriteBytes(b); } deveClient.Send(msg); }