public WriteReponseMessage Send(WriteMessage msg)
        {
            try
            {
                lock (objLock)
                {
                    SendMessage(msg);

                    string ip          = client.Client.RemoteEndPoint.ToString();
                    var    stream      = client.GetStream();
                    byte[] heardBuffer = Recevid(Config.HeardSize, stream.Read);

                    var dataBuffer = Recevid(4, stream.Read);
                    RecevidLog(ip, heardBuffer.Concat(dataBuffer).ToArray());

                    var data     = BitConverter.ToString(dataBuffer);
                    var writeMsg = new WriteReponseMessage();
                    writeMsg.Parse(data);
                    return(writeMsg);
                }
            }
            catch (SocketException e)
            {
                ReConnect(e);
                throw;
            }
            catch (Exception e)
            {
                if (e.InnerException() is SocketException ex)
                {
                    ReConnect(ex);
                }
                throw;
            }
        }
        public WriteReponseMessage Send(WriteMessage msg)
        {
            try
            {
                lock (objLock)
                {
                    if (client == null || client.IsOpen != Connected)
                    {
                        ReConnect();
                    }
                    if (client == null || !client.IsOpen || !Connected)
                    {
                        return new WriteReponseMessage()
                               {
                                   List = new List <short> {
                                       0
                                   }
                               }
                    }
                    ;
                    Send(client.PortName, msg, client.Write);

                    byte[] heardBuffer = Recevid(Config.HeardSize, client.Read);

                    var dataBuffer = Recevid(4 + 2, client.Read);
                    RecevidLog(client.PortName, heardBuffer.Concat(dataBuffer).ToArray());

                    var data     = BitConverter.ToString(dataBuffer);
                    var writeMsg = new WriteReponseMessage();
                    writeMsg.Parse(data);
                    return(writeMsg);
                }
            }
            catch (Exception)
            {
                ReConnect();
                throw;
            }
        }