public ReadReponseMessage Send(ReadMessage msg) { try { lock (objLock) { SendMessage(msg); string ip = client.Client.RemoteEndPoint.ToString(); var stream = client.GetStream(); byte[] heardBuffer = Recevid(Config.HeardSize, stream.Read); byte[] dataBuffer = Recevid(2, stream.Read); var length = BitConverter.ToInt16(dataBuffer.Reverse().ToArray(), 0); dataBuffer = Recevid(length, stream.Read); RecevidLog(ip, heardBuffer.Concat(dataBuffer).ToArray()); var data = BitConverter.ToString(dataBuffer); var readMsg = new ReadReponseMessage(); readMsg.Parse(data); return(readMsg); } } catch (SocketException e) { ReConnect(e); throw; } catch (Exception e) { if (e.InnerException() is SocketException ex) { ReConnect(ex); } throw; } }
public ReadReponseMessage Send(ReadMessage msg) { throw new NotImplementedException(); }