コード例 #1
0
        private void LoginCallBack(IAsyncResult ar)
        {
            Socket socket = ar.AsyncState as Socket;

            socket.EndSend(ar);
            byte[] buffer      = new byte[1024];
            int    receiveSize = 0;

            try { receiveSize = socket.Receive(buffer); }
            catch (Exception e)
            {
                FileOperation.ExceptionHandle(e, "Server Disconnected!");
            }
            string receivedString = Encoding.Default.GetString(buffer, 0, receiveSize);

            if (receivedString == "WrongPassword" || receivedString == "WrongUsername")
            {
                Dispatcher.Invoke(() => { ShowOverlayMessage("Failed to Login:"******"Resources\UserInfo.cfg", buffer, receiveSize);
            workingResources.ReloadInformation();
        }