Esempio n. 1
0
        private async void Client_BinaryInput(ISocketClient client, ZYSocket.ISockAsyncEventAsClient socketAsync)
        {
            var res = await socketAsync.GetFiberRwSSL(null, "localhost");  //我们在这地方使用SSL加密


            if (res.IsError)
            {
                MessageBox.Show(res.ErrMsg);
                client.ShutdownBoth();
                return;
            }

            client.SetConnected();

            for (; ;)
            {
                try
                {
                    await ReadCommand(res.FiberRw);
                }
                catch (Exception er)
                {
                    MessageBox.Show(er.ToString());
                    break;
                }
            }

            client.ShutdownBoth();
        }
Esempio n. 2
0
 private void Client_Disconnect(ISocketClient client, ZYSocket.ISockAsyncEventAsClient socketAsync, string msg)
 {
     this.BeginInvoke(new EventHandler((a, b) =>
     {
         MessageBox.Show(msg);
         this.Close();
     }));
 }