Esempio n. 1
0
        private void DoSendImsMsg(ImsResponse responseMsg)
        {
            try
            {
                if (ImsNetManager.Instance.IsImsSocketConnect())
                {
                    IMsgInfo msg     = responseMsg;
                    MsgSend  msgSend = new MsgSend();
                    int      res     = msgSend.ConvertFrom(msg);
                    if (0 == res)
                    {
                        byte[] data = msgSend.CloneBytes();
                        ImsNetManager.Instance.NowImsStation.SendBytes(data);

                        //  Logger.LogInfo(null, "向IMS发送响应消息 :【" + BitConverter.ToString(responseMsg.CloneMsgBytes()) + "】");
                    }
                    else
                    {
                        //  Logger.LogError(null, "向IMS发送响应消息 :【" + "消息不合法" + "】");
                    }
                }
            }
            catch (SocketException ex)
            {
                ImsNetManager.Instance.NowImsStation.CloseImsConn();
                // Logger.LogError(null, "IMS发送响应消息时捕获到SOCKET异常:【" + ex.Message+"】");
            }
            catch (Exception ex)
            {
                ImsNetManager.Instance.NowImsStation.CloseImsConn();
                // Logger.LogError(null, "IMS发送响应消息时捕获到未知异常:【" + ex.Message+"】");
            }
        }