Beispiel #1
0
        public void GetServerMessage()
        {
            if (App.client != null)
            {
                try
                {
                    NetworkStream stream = App.client.GetStream();

                    byte[] bytes = new byte[256];
                    string data  = null;


                    int i;
                    while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)
                    {
                        data = Encoding.UTF8.GetString(bytes, 0, i);

                        if (isSend == false)
                        {
                            ToastMessage toast = new ToastMessage();
                            toast.ShowNotification("서버 메세지", data);
                        }
                        isSend = false;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("실패");
                    Console.WriteLine(e.ToString());
                }
            }
        }