private void SendRequest(string request) { var md5request = $"{CheksumGenerator.CreateMD5(request)} {request}"; byte[] buffer = Encoding.ASCII.GetBytes(md5request); ClientSocket.Send(buffer); }
private string ReceiveResponse() { string text; int received = ClientSocket.Receive(buffer, SocketFlags.None); if (received == 0) { return(""); } var data = new byte[received]; Array.Copy(buffer, data, received); text = Encoding.ASCII.GetString(data); var cleanText = text.Substring(33); var md5 = text.Substring(0, 32); if (CheksumGenerator.CreateMD5(cleanText) != md5) { MessageBox.Show("Odebrano niekompletne dane"); return(null); } return(cleanText); }