コード例 #1
0
        private OperateResult CreatePush( )
        {
            CoreSocket?.Close( );

            OperateResult <Socket> connect = CreateSocketAndConnect(endPoint, 5000);

            if (!connect.IsSuccess)
            {
                return(connect);
            }

            OperateResult send = SendStringAndCheckReceive(connect.Content, 0, keyWord);

            if (!send.IsSuccess)
            {
                return(send);
            }

            OperateResult <int, string> receive = ReceiveStringContentFromSocket(connect.Content);

            if (!receive.IsSuccess)
            {
                return(receive);
            }

            if (receive.Content1 != 0)
            {
                return(new OperateResult(receive.Content2));
            }

            AppSession appSession = new AppSession( );

            CoreSocket            = connect.Content;
            appSession.WorkSocket = connect.Content;
            ReBeginReceiveHead(appSession, false);

            return(OperateResult.CreateSuccessResult( ));
        }
コード例 #2
0
 /// <summary>
 /// 关闭消息推送的界面
 /// </summary>
 public void ClosePush( )
 {
     action = null;
     CoreSocket?.Close( );
 }