示例#1
0
        private void FindWindow_ThreadProc(object param)
        {
            IntPtr ptrToString = Marshal.StringToHGlobalUni((string)param);
            bool   bresult     = Win32APIs.EnumWindows(FindWinForm, ptrToString);

            m_WindowFoundEvent.Set();
        }
示例#2
0
 void whenConnectionFailed(int id)
 {
     Win32APIs.SendMsgData("TcpClientBase.tryConnection: start connection fail process.", "LogWindow");
     if (_isPermarnentConnecting)
     {
         Win32APIs.SendMsgData("TcpClientBase.tryConnection: permanent connection mode: trying reconnect", "LogWindow");
         if (id == _threadId)
         {
             ConnectionEvent(ConnType.Connecting);
         }
         if (_isDisposing == false)
         {
             Thread.Sleep(1000);
             if (_isDisposing == false)
             {
                 StartConnection(_connectionTimeout, _runRecvThreadWhenConnected);
             }
         }
     }
     else
     {
         Win32APIs.SendMsgData("TcpClientBase.tryConnection:finish trying connection.", "LogWindow");
         //_isConnecting = false;
         if (id == _threadId)
         {
             ConnectionEvent(ConnType.Disconnected);
         }
     }
     Win32APIs.SendMsgData("TcpClientBase.tryConnection:removing current thread[" + id + "]", "LogWindow");
     RemoveThread(id);
     Win32APIs.SendMsgData("TcpClientBase.tryConnection: current thread[" + id + "] removed", "LogWindow");
 }
示例#3
0
        void RemoveThread(int id)
        {
            if (_clientThreads.ContainsKey(id))
            {
                try{
                    _clients[id].Client.Blocking = false;
                    _clients[id].Client.Disconnect(false);
                    _clients[id].Client.Close(1000);
                }catch {}
                try
                {
                    _clients.Remove(id);
                    Thread t = _clientThreads[id];

                    try
                    {
                        _clientThreads[id].Abort();
                        _clientThreads[id].Join(1000);
                    }
                    catch { }
                    _clientThreads.Remove(id);
                }
                catch (Exception e)
                {
                    Win32APIs.SendMsgData("TcpClientBase.RemoveThread:" + e.Message, "LogWindow");
                }
            }
        }
示例#4
0
        public void releaseRecvThread()
        {
            if (_recvThread == null)
            {
                return;
            }

            if (_recvThread != null)
            {
                _isEndConnection = true; //thread 종료조건 설정 후
                while (_isRecvThreadRunning)
                {
                    writeLog("waiting recv thread stopping...");
                    if (_server != null && _server.Client != null)
                    {
                        if (_server.Client.Blocking)
                        {
                            _server.Client.Blocking = false;
                        }
                        try{
                            _server.Close();
                        }catch {
                            Win32APIs.SendMsgData("TcpClientBase:Thread해제시 소켓클로즈 안됨.", "LogWindow");
                        }
                        _server.Client = null;
                        _recvThread.Abort();
                        _recvThread = null;
                    }
                    Thread.Sleep(100);
                }
            }
        }
示例#5
0
        void whenConnectionFailed(int id)
        {
            Win32APIs.SendMsgData("tryConnection:연결시도가 실패하였음.", "LogWindow");
            if (_isPermarnentConnecting)
            {
                Win32APIs.SendMsgData("tryConnection:계속 접속모드: 재접속 호출", "LogWindow");
                if (id == _threadId)
                {
                    ConnectionEvent(ConnType.Connecting);
                }
                if (_isDisposing == false)
                {
                    Thread.Sleep(1000);
                    if (_isDisposing == false)
                    {
                        StartConnection(_connectionTimeout, _runRecvThreadWhenConnected);
                    }
                }
            }
            else
            {
                Win32APIs.SendMsgData("tryConnection:연결시도 마침.", "LogWindow");
                //_isConnecting = false;
                if (id == _threadId)
                {
                    ConnectionEvent(ConnType.Disconnected);
                }
            }
            Win32APIs.SendMsgData("tryConnection:기존 thread 삭제", "LogWindow");

            RemoveThread(id);
        }
示例#6
0
 /// <summary>
 /// 모든 실행중인 thread와 연결시도를 끝낸다.
 /// </summary>
 public override void Close()
 {
     //_connectionTimer.Stop();
     _isDisposing            = true;
     _isPermarnentConnecting = false;
     Win32APIs.SendMsgData("TcpClientBase.Close: closing connection...", "LogWindow");
     //releaseThreads();
     Disconnect();
 }
示例#7
0
        private void SubscribeEvents()
        {
            _selectedToken = EventAggregatorManager.Instance.EventAggregator.GetEvent <CardSelectedEvent>().Subscribe((argument) =>
            {
                switch (argument.Argument.Category)
                {
                case Category.DesktopCard:
                    IsDesktopSelected = true;
                    IsDocSelected     = false;
                    break;

                case Category.DocCard:
                    IsDocSelected     = true;
                    IsDesktopSelected = false;

                    OpenFileDialog openFileDialog   = new OpenFileDialog();
                    openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                    openFileDialog.Multiselect      = false;
                    openFileDialog.Filter           = "文档|*.doc;*.docx;*.ppt;*.pptx;*.xls;*.xlsx;*.pdf";
                    openFileDialog.ShowDialog();
                    string fileName = openFileDialog.FileName;

                    if (!string.IsNullOrEmpty(fileName))
                    {
                    }

                    break;
                }
            }, ThreadOption.PublisherThread, true, filter => { return(filter.Target == Target.SharingOptionsViewModel); });

            _sharingToken = EventAggregatorManager.Instance.EventAggregator.GetEvent <StartSharingEvent>().Subscribe((argument) =>
            {
                if (IsDesktopSelected)
                {
                    CMeetingConfigurationDotNetWrap.Instance.SetSharingToolbarVisibility(false);
                    CMeetingUIControllerDotNetWrap.Instance.ShowSharingToolbar(false);

                    IntPtr desktopHandle = Win32APIs.GetDesktopWindow();

                    SDKError error = CMeetingShareControllerDotNetWrap.Instance.StartAppShare(new HWNDDotNet()
                    {
                        value = (uint)desktopHandle.ToInt32()
                    });
                }
                else if (IsDocSelected)
                {
                }
                else
                {
                    MessageBox.Show("请选择共享源!");
                }
            }, ThreadOption.PublisherThread, true, filter => { return(filter.Target == Target.SharingOptionsViewModel); });
        }
示例#8
0
 public IntPtr FindWindowAsynch(string windowName, int timeOut, out uint procId)
 {
     procId  = 0;
     m_Index = 0;
     FindWindowAsynch(windowName, timeOut);
     if (m_WindowFound)
     {
         Win32APIs.GetWindowThreadProcessId(m_WindowHandle, out procId);
         return(m_WindowHandle);
     }
     else
     {
         return(IntPtr.Zero);
     }
 }
示例#9
0
        /// <summary>
        /// 타이머가 계속 돌면서 연결중인지 아닌지를 검사함..
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void _connectionTimer_Elapsed(object sender, Timers.ElapsedEventArgs e)
        {
            if (_serverIp.Length == 0)
            {
                return;                        //초기상태
            }
            try
            {
                if (_server.Client.Connected)            //연결되었으면
                {
                    ConnectionEvent(ConnType.Connected); //연결이 되어있는 상태라면 이 명령은 효과없음..
                }
                else //연결이 아직 안되었는데,,
                {
                    Win32APIs.SendMsgData("접속 타이머: 연결 아직 안됨.", "LogWindow");

                    Win32APIs.SendMsgData("접속 타이머: 접속 시도중.", "LogWindow");
                    if (_isPermarnentConnecting)     //계속 체크중인 것
                    {
                        ConnectionEvent(ConnType.Connecting);
                    }
                    else     //timeout에 걸린 것
                    {
                        _server.Client.Close(1000);
                        ///_server.Close(); //연결 중이라고 해도 끊음..
                        ConnectionEvent(ConnType.Disconnected);
                    }
                }
            }
            catch (Exception ex) { //소켓이 손상되었을 때
                _connectionTimer.Stop();
                Win32APIs.SendMsgData("접속 타이머: 소켓 손상의심: " + ex.Message, "LogWindow");
                if (_isPermarnentConnecting)     //계속 체크중인 것
                {
                    ConnectionEvent(ConnType.Disconnected);
                    Win32APIs.SendMsgData("접속 타이머: 계속 접속모드 - 재접속", "LogWindow");
                    if (_isDisposing == false)
                    {
                        StartConnection(0, _runRecvThreadWhenConnected);                         //소켓을 다시 만들어야한다.
                    }
                }
                else     //다시 만들 필요가 없다. 기다리지 않는 모드이므로..
                {
                    Win32APIs.SendMsgData("접속 타이머: 단일 접속모드 - 접속끊음.", "LogWindow");
                    ConnectionEvent(ConnType.Disconnected);
                }
            }
        }
示例#10
0
        // Socket _runningSocket = null;
        private void serverLoop()
        {
            while (!_isEndServer)
            {
                int id = -1;
                Console.WriteLine("server ready...");
                try
                {
                    TcpClient client = _listener.AcceptTcpClient();
                    if (_isEndServer)
                    {
                        break;
                    }

                    id = getBlankClient();
                    if (id >= 0)
                    {
                        _client[id] = client;
                    }
                    else
                    {
                        Win32APIs.SendMsgData("TcpServerBase.serverLoop: Server Listener: 한계크기" + _maxClientNum + "보다 큰 접속 시도. 끊음..", "LogWindow");
                        client.Close();     //그냥 끊어버림..
                        Thread.Sleep(1000); //1초 뒤에 다시 받음..
                        continue;
                    }
                    _isEndConnection[id] = false;
                    _queue[id].Clear();    //초기화
                    ConnectionEvent(ConnType.Connected, id);
                }
                catch
                {
                    this.Disconnect();
                    OnConnectionFailed();
                    break;
                }
                if (_isRunRecvThreadWhenConnected)
                {
                    makeRecvThread(id);
                }
            }
            Console.WriteLine("exit from while in Server...");
            _listener = null;
        }
示例#11
0
        private int FindWinForm(IntPtr hwnd, IntPtr lparam)
        {
            if (hwnd == null)
            {
                return(1);//true
            }
            if (Win32APIs.IsWindow(hwnd) && Win32APIs.IsWindowVisible(hwnd))
            {
                string        windowname   = Marshal.PtrToStringUni(lparam);
                StringBuilder stringBuffer = new StringBuilder(256);

                int    result = Win32APIs.GetWindowText(hwnd, stringBuffer, 256);
                string temp   = stringBuffer.ToString();
                bool   found  = false;
                if (exactMatch)
                {
                    found = temp.Equals(windowname);
                }
                else
                {
                    found = temp.Contains(windowname);
                }
                if (found)
                {
                    if (m_Index == 0)//if user is interested in forst occurence then return
                    {
                        m_WindowHandle = hwnd;
                        m_WindowFound  = true;
                        return(0);
                    }
                    else//maybe user is interested in nth occurence so keep looking
                    {
                        m_Index--;
                        return(1);
                    }
                }
            }
            return(1);
        }
示例#12
0
        /// <summary>
        /// Thread를 끝내지 않고 connection만 끝낸다.
        /// 이 명령은 ConnectionEvent를 발생시키지 않지만 PermanantConnection모드에서는
        /// 다시 접속을 시도한다.
        /// </summary>
        public void Disconnect(Func <int> funcRunningBeforeCloseSocket = null)
        {
            releaseResources();

            if (_server != null && _server.Client != null)
            {
                if (_server.Client.Blocking)
                {
                    _server.Client.Blocking = false;
                }
                Win32APIs.SendMsgData("Blocking 해제...", "LogWindow");
            }


            if (_server != null && _server.Client != null)
            {
                Byte[]      buff  = new Byte[1];
                SocketError error = SocketError.NoData;
                _server.SendTimeout = 1000;
                if (funcRunningBeforeCloseSocket != null)
                {
                    funcRunningBeforeCloseSocket.Invoke();
                }


                //int recv = _server.Client.Send(buff, 0, 1, SocketFlags.None, out error);
                //Win32APIs.SendMsgData("1byte 보낸 것 성공?"+recv+"\r\n", "LogWindow");
                //if (error != SocketError.Success)
                //{
                //   Win32APIs.SendMsgData("소켓손상...", "LogWindow");
                //이미 소켓이 손상된 경우..
                // _server = null;
                //}
                //else {//끝내기 전에 사용자가 원하는 작업 한 가지를 하고 끝낼 수 있다.

                try
                {
                    Win32APIs.SendMsgData("disconnect시도", "LogWindow");
                    try
                    {
                        _server.Client.Disconnect(false);
                        Win32APIs.SendMsgData("disconnect완료", "LogWindow");
                    }
                    catch (Exception ex)
                    {
                        Win32APIs.SendMsgData("disconnect시 에러:" + ex.Message, "LogWindow");
                    }
                    Win32APIs.SendMsgData("close시도", "LogWindow");
                    _server.Client.Close(1000);
                    Win32APIs.SendMsgData("close완료", "LogWindow");
                }
                catch (Exception e) {
                    Win32APIs.SendMsgData("close시 에러..\r\n" + e.Message, "LogWindow");
                }

                //}
            }
            //미리 삭제된 개체였을 가능성..
            _server          = null;
            _connectionState = ConnType.Disconnected;
            //ConnectionEvent(ConnType.Disconnected);
        }
示例#13
0
        private void tryConnection()
        {
            int id = _threadId; //현재 id를 이thread가 끝나는 순간까지 가지고 있는다.

            TcpClient conn = new TcpClient();

            _clients[id] = conn;
            _queue.Clear();//이전 것은 의미가 없으므로 다시 큐를 비워줌..
            Win32APIs.SendMsgData("TcpClientBase.tryConnection: new socket created", "LogWindow");

            Win32APIs.SendMsgData("TcpClientBase.tryConnection: trying connection...", "LogWindow");
            try
            {
                conn.Connect(_serverIp, _serverPort);
            }
            catch (Exception e) {
                Win32APIs.SendMsgData("TcpClientBase.tryConnection: failed to connect" + e.Message, "LogWindow");
                whenConnectionFailed(id);
                return;
            }
            Win32APIs.SendMsgData("TcpClientBase.tryConnection: connection completed", "LogWindow");

            if (conn != null && conn.Client != null && conn.Connected == true)
            {
                Win32APIs.SendMsgData("TcpClientBase.tryConnection: connected", "LogWindow");
                ConnectionEvent(ConnType.Connected);
                Win32APIs.SendMsgData("TcpClientBase.tryConnection: after connection process done(" + _serverIp + ":" + _serverPort + ")", "LogWindow");
                //_isConnecting = false;
                if (_runRecvThreadWhenConnected)
                {
                    recvLoop();

                    Win32APIs.SendMsgData("TcpClientBase.tryConnection: recv loop has finished because of some fault...", "LogWindow");

                    //_checkConnectionThread.Abort();
                    //연결이 끊어지거나 문제가있어서 끝난 것. 후속처리..
                    if (_isDisposing == false)
                    {
                        whenConnectionFailed(id);
                        Win32APIs.SendMsgData("TcpClientBase.tryConnection: after recv loop finish process done...", "LogWindow");
                    }


                    //끝나면 thread를 삭제해야 함..v
                }
            }
            else
            {
                Win32APIs.SendMsgData("TcpClientBase.tryConnection: connection failed", "LogWindow");
                whenConnectionFailed(id);
                Win32APIs.SendMsgData("TcpClientBase.tryConnection: after connection fail process done...", "LogWindow");

                return;
            }
            #region old

            /*
             * try
             * {
             *  while (_isConnecting)
             *  {
             *      if (_nowConn != null && _nowConn.Client.Connected)
             *      {
             *
             *          //_checkConnectionThread.Abort();
             *          break;// return;
             *      }
             *      else
             *      {
             *          if (_isDisposing == false)
             *          {
             *              try
             *              {
             *                  Win32APIs.SendMsgData("tryConnection: 접속 시도", "LogWindow");
             *                  _nowConn.Connect(_serverIp, _serverPort);
             *                  Win32APIs.SendMsgData("tryConnection: 접속 시도 끝", "LogWindow");
             *
             *                  if (_nowConn != null && _nowConn.Client != null && _nowConn.Connected == true)
             *                  {
             *                      Win32APIs.SendMsgData("tryConnection: 연결됨1", "LogWindow");
             *                      ConnectionEvent(ConnType.Connected);
             *                      Win32APIs.SendMsgData("tryConnection: 연결됨2", "LogWindow");
             *                      _isConnecting = false;
             *                      runRecvThread();
             *                      //_checkConnectionThread.Abort();
             *                  }
             *                  else
             *                  {
             *                      Win32APIs.SendMsgData("tryConnection:연결된 후 뭔가 잘못되었다.", "LogWindow");
             *                      if (_isPermarnentConnecting)
             *                      {
             *                          Win32APIs.SendMsgData("tryConnection:계속 접속모드: 재접속 호출", "LogWindow");
             *                          _connectionState = ConnType.Disconnected;
             *                          _isConnecting = false;
             *                          _connectionTimer.Start();
             *                          //if (_isDisposing == false) StartConnection(_connectionTimeout, _runRecvThreadWhenConnected);
             *
             *                          break;// return;
             *                      }
             *                      else
             *                      {
             *                          Win32APIs.SendMsgData("tryConnection:연결시도 마침.", "LogWindow");
             *                          _isConnecting = false;
             *                          ConnectionEvent(ConnType.Disconnected);
             *                          //_checkConnectionThread.Abort();
             *                      }
             *                  }
             *
             *              }
             *              catch (Exception e)
             *              {
             *                  Win32APIs.SendMsgData("tryConnection:CONNECTION 실패 1:" + e.Message + "재접속 시도", "LogWindow");
             *                  Win32APIs.SendMsgData("tryConnection:재접속시도", "LogWindow");
             *                  Thread.Sleep(1000);
             *                  if (_isPermarnentConnecting)
             *                  {
             *                      Win32APIs.SendMsgData("tryConnection:계속 접속모드: 재접속 호출", "LogWindow");
             *                      _connectionState = ConnType.Disconnected;
             *
             *                      //_isConnecting = false;
             *                      //_connectionTimer.Start();
             *                      if (_isDisposing == false) StartConnection(_connectionTimeout, _runRecvThreadWhenConnected);
             *                      break;
             *                  }
             *                  else
             *                  {
             *                      _isConnecting = false;
             *                      Win32APIs.SendMsgData("tryConnection:연결시도 마침.", "LogWindow");
             *                      ConnectionEvent(ConnType.Disconnected);
             *                      break;//return;
             *                  }
             *                  // _checkConnectionThread.Abort();
             *
             *              }
             *          }
             *          else
             *          {
             *              //_checkConnectionThread.Abort();
             *              break;// return;
             *          }
             *      }
             *  }
             * }
             * catch { }
             * _isConnecting = false;
             */
            #endregion
        }
示例#14
0
        /// <summary>
        /// 연결시도를 시작한다. 무한대기를 위해서는 connectionTimeout을 0으로 하면 된다.
        /// </summary>
        /// <param name="connectionTimeoutWithMs">연결시도 timeout 시간. ms단위. 0으로 하면 무한히 연결시도를한다.</param>
        /// <param name="runRecvThreadWhenConnected">true일 경우 receive thread를 연결되자마자 자동으로 시작함.</param>
        void StartConnection(int connectionTimeoutWithMs = 2000, bool runRecvThreadWhenConnected = false)
        {
            if (_isConnecting)
            {
                return;
            }
            _isConnecting = true;

            if (connectionTimeoutWithMs <= 0)
            {
                _isPermarnentConnecting = true;
            }
            else
            {
                _isPermarnentConnecting = false;
            }

            if (_connectionState != ConnType.Disconnected) //현재 연결진행중이면 그냥 나간다.
            {
                Win32APIs.SendMsgData("StartConnection: 이미 연결되었거나 연결중 - 무시", "LogWindow");
                return;
            }
            else
            {
                if (_connectionTimer.Enabled == true)
                {
                    _connectionTimer.Stop(); //timeout을 위하여
                }

                _connectionTimer.Interval = (_isPermarnentConnecting) ? 1000 : connectionTimeoutWithMs; //무한대기는 1000ms마다 체크한다.



                ConnectionEvent(ConnType.Connecting);

                _isDisposing = false;
                _queue.Clear();

                _runRecvThreadWhenConnected = runRecvThreadWhenConnected;

                if (_server != null && _server.Client != null)
                {
                    try
                    {
                        Win32APIs.SendMsgData("StartConnection: 기존 연결 Disconnect", "LogWindow");
                        _server.Client.Disconnect(false);
                        Win32APIs.SendMsgData("StartConnection: 이전 연결 Disconnect성공:", "LogWindow");
                    }
                    catch (Exception e)
                    {
                        Win32APIs.SendMsgData("StartConnection: 이전 소켓 disconnect시 실패:" + e.Message, "LogWindow");
                    }
                    try
                    {
                        Win32APIs.SendMsgData("StartConnection: 기존 소켓 Close", "LogWindow");
                        _server.Client.Close(1000);
                        Win32APIs.SendMsgData("StartConnection: 이전 소켓 Close성공:", "LogWindow");
                    }
                    catch (Exception e)
                    {
                        Win32APIs.SendMsgData("StartConnection: 이전 소켓 Close시 실패:" + e.Message, "LogWindow");
                    }
                }
                _server = null;
                if (_checkConnectionThread != null) //기존에 연결시도중인 연결이 있다면 삭제하는 루틴..
                {
                    Win32APIs.SendMsgData("StartConnection: 기존 Thread 삭제 시도", "LogWindow");

                    if (_checkConnectionThread.ThreadState != ThreadState.Aborted && _checkConnectionThread.ThreadState != ThreadState.AbortRequested && _checkConnectionThread.ThreadState != ThreadState.Stopped)
                    {
                        Win32APIs.SendMsgData("StartConnection: 기존 Thread 삭제 중- 현재상태:" + _checkConnectionThread.ThreadState.ToString(), "LogWindow");

                        _checkConnectionThread.Abort();
                        _checkConnectionThread = null;
                        Win32APIs.SendMsgData("StartConnection: 기존 Thread 삭제 완료", "LogWindow");
                    }
                    else
                    {
                        Win32APIs.SendMsgData("StartConnection: 기존 Thread 삭제 필요없음.", "LogWindow");
                    }
                }
                Win32APIs.SendMsgData("StartConnection: 소켓 새로 생성", "LogWindow");
                _server = new TcpClient();
                Win32APIs.SendMsgData("StartConnection: 소켓 새로 생성 완료", "LogWindow");

                _checkConnectionThread = new Thread(new ThreadStart(tryConnection));

                _checkConnectionThread.Start();
                _connectionTimer.Start();
            }
        }
示例#15
0
        /*
         * public void releaseRecvThread()
         * {
         *  if (_recvThread == null)
         *  {
         *      return;
         *  }
         *
         *  if (_recvThread != null)
         *  {
         *
         *      _isEndConnection = true; //thread 종료조건 설정 후
         *      while (_isRecvThreadRunning)
         *      {
         *          writeLog("waiting recv thread stopping...");
         *          if(_nowConn!=null && _nowConn.Client!=null){
         *              if(_nowConn.Client.Blocking) _nowConn.Client.Blocking = false;
         *              try{
         *                  _nowConn.Close();
         *              }catch{
         *                  Win32APIs.SendMsgData("TcpClientBase:Thread해제시 소켓클로즈 안됨.", "LogWindow");
         *
         *              }
         *              _nowConn.Client = null;
         *
         *          }
         *          Thread.Sleep(100);
         *      }
         *      _recvThread.Abort();
         *      _recvThread = null;
         *  }
         * }
         */
        /// <summary>
        /// Thread를 끝내지 않고 connection만 끝낸다.
        /// 이 명령은 ConnectionEvent를 발생시키지 않지만 PermanantConnection모드에서는
        /// 다시 접속을 시도한다.
        /// </summary>
        public override void Disconnect(Func <int> funcRunningBeforeCloseSocket = null)
        {
            if (funcRunningBeforeCloseSocket != null)
            {
                funcRunningBeforeCloseSocket.Invoke();
            }
            releaseThreads();
            releaseResources();
            ConnectionEvent(ConnType.Disconnected);
            _connectionState = ConnType.Disconnected;
            Win32APIs.SendMsgData("TcpClientBase.Disconnect: disconnected.", "LogWindow");
            #region old

            /*
             *
             * if (_nowConn != null && _nowConn.Client != null)
             * {
             *  if (_nowConn.Client.Blocking) _nowConn.Client.Blocking = false;
             *  Win32APIs.SendMsgData("Blocking 해제...", "LogWindow");
             * }
             *
             *
             * if (_nowConn!=null && _nowConn.Client != null)
             * {
             *  Byte[] buff = new Byte[1];
             *  SocketError error = SocketError.NoData;
             *  _nowConn.SendTimeout = 1000;
             *  if (funcRunningBeforeCloseSocket != null) funcRunningBeforeCloseSocket.Invoke();
             *
             *
             *  //int recv = _server.Client.Send(buff, 0, 1, SocketFlags.None, out error);
             *  //Win32APIs.SendMsgData("1byte 보낸 것 성공?"+recv+"\r\n", "LogWindow");
             *  //if (error != SocketError.Success)
             *  //{
             *      //   Win32APIs.SendMsgData("소켓손상...", "LogWindow");
             *      //이미 소켓이 손상된 경우..
             *      // _server = null;
             *  //}
             *  //else {//끝내기 전에 사용자가 원하는 작업 한 가지를 하고 끝낼 수 있다.
             *
             *      try
             *      {
             *          Win32APIs.SendMsgData("disconnect시도", "LogWindow");
             *          try
             *          {
             *              _nowConn.Client.Blocking = false;
             *              _nowConn.Client.Disconnect(false);
             *              Win32APIs.SendMsgData("disconnect완료", "LogWindow");
             *          }
             *          catch(Exception ex)
             *          {
             *              Win32APIs.SendMsgData("disconnect시 에러:"+ex.Message, "LogWindow");
             *          }
             *          Win32APIs.SendMsgData("close시도", "LogWindow");
             *
             *          _nowConn.Client.Close(1000);
             *          Win32APIs.SendMsgData("close완료", "LogWindow");
             *      }
             *      catch(Exception e) {
             *          Win32APIs.SendMsgData("close시 에러..\r\n"+e.Message, "LogWindow");
             *      }
             *
             *  //}
             * }
             * //미리 삭제된 개체였을 가능성..
             * _nowConn = null;
             * _connectionState = ConnType.Disconnected;
             * //ConnectionEvent(ConnType.Disconnected);
             */
            #endregion
        }
示例#16
0
        private void tryConnection()
        {
            if (_server != null && _server.Client.Connected)
            {
                //_checkConnectionThread.Abort();
                return;
            }
            else
            {
                if (_isDisposing == false)
                {
                    try
                    {
                        Win32APIs.SendMsgData("tryConnection: 접속 시도", "LogWindow");
                        _server.Connect(_serverIp, _serverPort);
                        Win32APIs.SendMsgData("tryConnection: 접속 시도 끝", "LogWindow");

                        if (_server != null && _server.Client != null && _server.Connected == true)
                        {
                            Win32APIs.SendMsgData("tryConnection: 연결됨1", "LogWindow");
                            ConnectionEvent(ConnType.Connected);
                            Win32APIs.SendMsgData("tryConnection: 연결됨2", "LogWindow");
                            _isConnecting = false;
                            //_checkConnectionThread.Abort();
                        }
                        else
                        {
                            Win32APIs.SendMsgData("tryConnection:연결된 후 뭔가 잘못되었다.", "LogWindow");
                            if (_isPermarnentConnecting)
                            {
                                Win32APIs.SendMsgData("tryConnection:계속 접속모드: 재접속 호출", "LogWindow");
                                _connectionState = ConnType.Disconnected;
                                _isConnecting    = false;
                                _connectionTimer.Start();
                                //if (_isDisposing == false) StartConnection(_connectionTimeout, _runRecvThreadWhenConnected);

                                return;
                            }
                            else
                            {
                                Win32APIs.SendMsgData("tryConnection:연결시도 마침.", "LogWindow");
                                _isConnecting = false;
                                ConnectionEvent(ConnType.Disconnected);
                                //_checkConnectionThread.Abort();
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Win32APIs.SendMsgData("tryConnection:CONNECTION 실패 1:" + e.Message + "재접속 시도", "LogWindow");
                        Win32APIs.SendMsgData("tryConnection:재접속시도", "LogWindow");

                        if (_isPermarnentConnecting)
                        {
                            Win32APIs.SendMsgData("tryConnection:계속 접속모드: 재접속 호출", "LogWindow");
                            _connectionState = ConnType.Disconnected;
                            _isConnecting    = false;
                            _connectionTimer.Start();
                            //if (_isDisposing == false) StartConnection(_connectionTimeout, _runRecvThreadWhenConnected);
                        }
                        else
                        {
                            _isConnecting = false;
                            Win32APIs.SendMsgData("tryConnection:연결시도 마침.", "LogWindow");
                            ConnectionEvent(ConnType.Disconnected);
                        }
                        // _checkConnectionThread.Abort();
                        return;
                    }
                }
                else
                {
                    //_checkConnectionThread.Abort();
                    return;
                }
            }
        }
示例#17
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (CurrentCell == null || CurrentCell.ColumnIndex < 0 || CurrentCell.RowIndex < 0) //current cell이 없다는 것은 key의 효력이 없다.
            {
                base.OnKeyDown(e);
                return;
            }
            if (EditingControl != null)
            {
                base.OnKeyDown(e);
                return;
            }

            if (_goBack)//이전에 _goBack이 있었다면,
            {
                _goBack     = false;
                CurrentCell = Cell(Before);//이전셀로 돌아간다. 이 때,LeaveCell과 EnterCell을 지나친다.
                Now.Set(Before);
            }
            else
            {
                Now.Set(CurrentCell.RowIndex, CurrentCell.ColumnIndex);
            }

            //방향키
            #region 방향키..
            if (Control.ModifierKeys == Keys.None)
            {
                if (e.KeyData == Keys.Right) //next col then next row
                {
                    CurrentCell.Selected = false;
                    if (GoRight() == false)
                    {
                        CurrentCell          = Cell(Now);
                        CurrentCell.Selected = true;

                        /*
                         * if (Now.Col >= 0 && Now.Row >= 0 && Now.Row < this.Rows.Count && Now.Col < this.Columns.Count)
                         * {
                         * this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewCell);
                         * this.CurrentCell.Selected = true;
                         * }
                         */
                        return;
                    }
                    CurrentCell.Selected = true;
                }
                else if (e.KeyData == Keys.Left) //go left
                {
                    CurrentCell.Selected = false;
                    if (GoLeft() == false)
                    {
                        CurrentCell          = Cell(Now);
                        CurrentCell.Selected = true;

                        /*
                         * if (Now.Col >= 0 && Now.Row >= 0 && Now.Row < this.Rows.Count && Now.Col < this.Columns.Count)
                         * {
                         * this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewCell);
                         * this.CurrentCell.Selected = true;
                         * }
                         */
                        return;
                    }
                    CurrentCell.Selected = true;
                }

                else if (e.KeyData == Keys.Down) //next row
                {
                }
                else if (e.KeyData == Keys.Up) //next row
                {
                }
                else if (e.KeyData == Keys.Enter) //next row
                {
                    //Now.Row++;
                    if (ActionOnEnterInEditMode == EnterActions.EditNextRow)
                    {
                    }
                    else if (ActionOnEnterInEditMode == EnterActions.EditOnThePosition)
                    {
                        //BeginEdit(true);//Edit Start and Go Nowhere
                        //return;
                    }
                    else //go next col
                    {
                        CurrentCell.Selected = false;
                        if (GoRight() == false)
                        {
                            CurrentCell          = Cell(Now);
                            CurrentCell.Selected = true;

                            /*
                             * if (Now.Col >= 0 && Now.Row >= 0 && Now.Row < this.Rows.Count && Now.Col < this.Columns.Count)
                             * {
                             *  this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewCell);
                             *  this.CurrentCell.Selected = true;
                             * }
                             */
                            return;
                        }
                        CurrentCell.Selected = true;
                    }
                }

                else if (e.KeyData == Keys.Space)
                {
                }
                else if (e.KeyData == Keys.Delete)
                {
                    this.CurrentCell.Value = "";//.GetData("{0:S}");
                    this.BeginEdit(false);
                    this.CurrentCell.Value = BeforeText;
                }
                else //다른 키일때
                {
                    if (_editables[Now.Col] == true)
                    {
                        DataGridViewTextBoxCell cell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewTextBoxCell);
                        if (cell == null) //이런 경우는 있으면 안되지만 사용자의 실수를 고려하여..
                        {
                            base.OnKeyDown(e);
                            return;
                        }
                        if (this.EditingControl == null)
                        {
                            //this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewTextBoxCell);
                            BeforeText = this.CurrentCell.Value as String;
                        }

                        if ((int)e.KeyData >= (int)Keys.A && (int)e.KeyData <= (int)Keys.Z)
                        {
                            if (Win32APIs.GetKeyState(Keys.CapsLock) == false)
                            {
                                this.CurrentCell.Value = ((char)('a' + ((int)e.KeyData - (int)'A'))).ToString();
                            }
                            else
                            {
                                this.CurrentCell.Value = e.KeyCode.ToString();
                            }
                        }
                        else if ((int)e.KeyData >= (int)Keys.D0 && (int)e.KeyData <= (int)Keys.D9)
                        {
                            this.CurrentCell.Value = ((int)e.KeyData - (int)Keys.D0).ToString();
                        }

                        // V_Data.CurrentCell.Selected = false;
                        this.BeginEdit(false);
                        _isEditActivated = true;
                        if (this.EditingControl != null)
                        {
                            this.EditingControl.PreviewKeyDown += _editingControlEvent;
                            this.CurrentCell.Value              = BeforeText;
                        }
                    }
                }
            }
            else if (e.KeyData == (Keys.V | Keys.Control) && e.Control)
            {
                this.CurrentCell.Value = Clipboard.GetText();//.GetData("{0:S}");
                this.BeginEdit(false);
                this.CurrentCell.Value = BeforeText;
            }
            else if (e.KeyData == (Keys.C | Keys.Control) && e.Control)
            {
                Clipboard.SetText(this.CurrentCell.Value as String);
            }
            else if (Control.ModifierKeys == Keys.Control)
            {
                if (e.KeyData == (Keys.Right | Keys.Control)) //next col then next row
                {
                }
                else if (e.KeyData == (Keys.Left | Keys.Control)) //go left
                {
                }

                else if (e.KeyData == (Keys.Down | Keys.Control)) //next row
                {
                }
                else if (e.KeyData == (Keys.Up | Keys.Control)) //next row
                {
                }
                return;//selection을 움직이지 않는다.
            }
            else if (Control.ModifierKeys == Keys.Alt)
            {
                return;
            }
            else if (e.KeyData == Keys.Tab && e.Shift == false) //next col then next row
            {
                CurrentCell.Selected = false;
                if (GoRight(true) == false)
                {
                    CurrentCell          = Cell(Now);
                    CurrentCell.Selected = true;

                    /*
                     * if (Now.Col >= 0 && Now.Row >= 0 && Now.Row < this.Rows.Count && Now.Col < this.Columns.Count)
                     * {
                     *  this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewCell);
                     *  this.CurrentCell.Selected = true;
                     * }
                     */
                    return;
                }
                CurrentCell.Selected = true;
            }
            else if (e.KeyData == Keys.Tab && e.Shift == true) //go left in textfield
            {
                CurrentCell.Selected = false;

                if (GoLeft(true) == false)
                {
                    CurrentCell          = Cell(Now);
                    CurrentCell.Selected = true;

                    /*
                     * if (Now.Col >= 0 && Now.Row >= 0 && Now.Row < this.Rows.Count && Now.Col < this.Columns.Count)
                     * {
                     *  this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewCell);
                     *  this.CurrentCell.Selected = true;
                     * }
                     */
                    return;
                }
                CurrentCell.Selected = true;
            }
            else if (e.KeyData == (Keys.Shift | Keys.ShiftKey) || e.KeyData == Keys.ShiftKey || e.KeyData == Keys.LShiftKey)
            {
            }

            else if (e.KeyData == (Keys.LButton | Keys.ShiftKey | Keys.Control))
            {
            }
            else if (e.KeyData == (Keys.LButton | Keys.Shift | Keys.Back)) //Shift+Tab
            {
                CurrentCell.Selected = false;
                if (GoLeft(true) == false)
                {
                    CurrentCell          = Cell(Now);
                    CurrentCell.Selected = true;

                    /*
                     * if (Now.Col >= 0 && Now.Row >= 0 && Now.Row < this.Rows.Count && Now.Col < this.Columns.Count)
                     * {
                     *  this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewCell);
                     *  this.CurrentCell.Selected = true;
                     * }
                     */
                    return;
                }
                CurrentCell.Selected = true;
            }
            #endregion


            base.OnKeyDown(e);

            /*
             *
             * //if (this.CurrentCell != null)
             * if (Now.Row >= 0 && Now.Col >= 0)
             * {
             *  this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewCell);
             *  //if(Now.Row>=0 && Now.Col>=0) this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewTextBoxCell);
             *
             *  this.CurrentCell.Selected = true;
             *
             *  if (e.KeyData == Keys.Tab && e.Shift==false) //next col then next row
             *  {
             *      _isEditing = false;
             *      _posAfterEdit = Direction.NoPositioning;
             *      if (GoRight(true) == false)
             *      {
             *          if (Now.Col >= 0 && Now.Row >= 0 && Now.Row < this.Rows.Count && Now.Col < this.Columns.Count)
             *          {
             *              this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewCell);
             *              this.CurrentCell.Selected = true;
             *          }
             *          return;
             *      }
             *
             *  }
             *  if (e.KeyData == Keys.Right) //next col then next row
             *  {
             *      _isEditing = false;
             *      _posAfterEdit = Direction.NoPositioning;
             *      if (GoRight() == false)
             *      {
             *          if (Now.Col >= 0 && Now.Row >= 0 && Now.Row < this.Rows.Count && Now.Col < this.Columns.Count)
             *          {
             *              this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewCell);
             *              this.CurrentCell.Selected = true;
             *          }
             *          return;
             *      }
             *  }
             *  else if (e.KeyData == Keys.Left) //go left
             *  {
             *      _isEditing = false;
             *      _posAfterEdit = Direction.NoPositioning;
             *      if (GoLeft() == false)
             *      {
             *          if (Now.Col >= 0 && Now.Row >= 0 && Now.Row < this.Rows.Count && Now.Col < this.Columns.Count)
             *          {
             *              this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewCell);
             *              this.CurrentCell.Selected = true;
             *          }
             *          return;
             *      }
             *  }
             *  else if (e.KeyData == Keys.Tab && e.Shift==true) //go left in textfield
             *  {
             *      _isEditing = false;
             *      _posAfterEdit = Direction.NoPositioning;
             *      if (GoLeft(true) == false)
             *      {
             *          if (Now.Col >= 0 && Now.Row >= 0 && Now.Row < this.Rows.Count && Now.Col < this.Columns.Count)
             *          {
             *              this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewCell);
             *              this.CurrentCell.Selected = true;
             *          }
             *          return;
             *      }
             *  }
             *  else if (e.KeyData == Keys.Down) //next row
             *  {
             *      //Now.Row++;
             *      _isEditing = false;
             *      _posAfterEdit = Direction.NoPositioning;
             *      //GoDown();
             *  }
             *  else if (e.KeyData == Keys.Up) //next row
             *  {
             *      //Now.Row++;
             *      _isEditing = false;
             *      _posAfterEdit = Direction.NoPositioning;
             *      //GoUp();
             *  }
             *  else if (e.KeyData == Keys.Enter) //next row
             *  {
             *      //Now.Row++;
             *      _isEditing = false;
             *      _posAfterEdit = Direction.NoPositioning;
             *      if (ActionOnEnterInEditMode == EnterActions.EditNextRow)
             *      {
             *          GoDown();
             *      }
             *      else if (ActionOnEnterInEditMode == EnterActions.EditOnThePosition)
             *      {
             *          //go nowhere
             *          this.EndEdit();
             *          return;
             *      }
             *      else //go next col
             *      {
             *          if (GoRight() == false)
             *          {
             *              if (Now.Col >= 0 && Now.Row >= 0 && Now.Row < this.Rows.Count && Now.Col < this.Columns.Count)
             *              {
             *                  this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewCell);
             *                  this.CurrentCell.Selected = true;
             *              }
             *              return;
             *          }
             *      }
             *
             *  }
             *
             *  else if (e.KeyData == Keys.Space)
             *  {
             *      _posAfterEdit = Direction.NoPositioning;
             *  }
             *  else if (e.KeyData == Keys.Delete)
             *  {
             *      _posAfterEdit = Direction.NoPositioning;
             *      if (this.CurrentCell != null)
             *      {
             *          _isEditing = true;
             *          if (this.EditingControl == null)
             *          {
             *              BeforeText = this.CurrentCell.Value as String;
             *          }
             *          this.CurrentCell.Value = "";//.GetData("{0:S}");
             *          this.BeginEdit(false);
             *          this.CurrentCell.Value = BeforeText;
             *      }
             *  }
             *  else if (e.KeyData == (Keys.Shift|Keys.ShiftKey) || e.KeyData == Keys.ShiftKey || e.KeyData == Keys.LShiftKey)
             *  {
             *      _posAfterEdit = Direction.NoPositioning;
             *  }
             *  else if (e.KeyData == (Keys.V|Keys.Control) && e.Control)
             *  {
             *      _posAfterEdit = Direction.NoPositioning;
             *      if (this.CurrentCell != null)
             *      {
             *          _isEditing = true;
             *          if (this.EditingControl == null)
             *          {
             *              BeforeText = this.CurrentCell.Value as String;
             *          }
             *          this.CurrentCell.Value = Clipboard.GetText();//.GetData("{0:S}");
             *          this.BeginEdit(false);
             *          this.CurrentCell.Value = BeforeText;
             *      }
             *  }
             *  else if (e.KeyData ==(Keys.C|Keys.Control) && e.Control)
             *  {
             *      _posAfterEdit = Direction.NoPositioning;
             *      if (this.CurrentCell != null)
             *      {
             *          Clipboard.SetText(this.CurrentCell.Value as String);
             *      }
             *  }
             *  else if (e.KeyData == (Keys.LButton|Keys.ShiftKey|Keys.Control))
             *  {
             *      _posAfterEdit = Direction.NoPositioning;
             *  }
             *  else if (e.KeyData == (Keys.LButton | Keys.Shift | Keys.Back)) //Shift+Tab
             *  {
             *      _isEditing = false;
             *      _posAfterEdit = Direction.NoPositioning;
             *      if (GoLeft(true) == false)
             *      {
             *          if (Now.Col >= 0 && Now.Row >= 0 && Now.Row < this.Rows.Count && Now.Col < this.Columns.Count)
             *          {
             *              this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewCell);
             *              this.CurrentCell.Selected = true;
             *          }
             *          return;
             *      }
             *  }
             *
             *  else //다른 키일때
             *  {
             *      _posAfterEdit = Direction.NoPositioning;
             *      if (this.CurrentCell != null && (this.EditingControl == null))
             *      {
             *
             *          //V_Data..CurrentCell
             *          if (Now.Col >= 0)
             *          {
             *              if (_editables[Now.Col])
             *              {
             *                  _isEditing = true;
             *                  DataGridViewTextBoxCell cell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewTextBoxCell);
             *                  if (cell == null)
             *                  {
             *                      _isEditing = false;
             *                      base.OnKeyDown(e);
             *                      return;
             *                  }
             *                  if (this.EditingControl == null)
             *                  {
             *                      //this.CurrentCell = (Rows[Now.Row].Cells[Now.Col] as DataGridViewTextBoxCell);
             *                      BeforeText = this.CurrentCell.Value as String;
             *                  }
             *
             *                  if ((int)e.KeyData >= (int)Keys.A && (int)e.KeyData <= (int)Keys.Z)
             *                  {
             *
             *                      if (Win32APIs.GetKeyState(Keys.CapsLock) == false)
             *                      {
             *                          this.CurrentCell.Value = ((char)('a' + ((int)e.KeyData - (int)'A'))).ToString();
             *                      }
             *                      else
             *                      {
             *                          this.CurrentCell.Value = e.KeyCode.ToString();
             *                      }
             *                  }
             *                  else if ((int)e.KeyData >= (int)Keys.D0 && (int)e.KeyData <= (int)Keys.D9)
             *                  {
             *                      this.CurrentCell.Value = ((int)e.KeyData - (int)Keys.D0).ToString();
             *
             *                  }
             *
             *                  // V_Data.CurrentCell.Selected = false;
             *                  this.BeginEdit(false);
             *                  _isEditActivated = true;
             *                  if (this.EditingControl != null)
             *                  {
             *                      this.EditingControl.PreviewKeyDown += _editingControlEvent;
             *                      this.CurrentCell.Value = BeforeText;
             *                  }
             *              }
             *          }
             *      }
             *  }
             * }
             * else
             * {
             *  _isEditing = false;
             * }
             *
             * base.OnKeyDown(e);
             */
        }
示例#18
0
        private void tryConnection()
        {
            int id = _threadId; //현재 id를 이thread가 끝나는 순간까지 가지고 있는다.

            Win32APIs.SendMsgData("StartConnection: 소켓 새로 생성", "LogWindow");
            TcpClient conn = new TcpClient();

            _clients.Add(id, conn);
            _queue.Clear();//이전 것은 의미가 없으므로 다시 큐를 비워줌..
            Win32APIs.SendMsgData("StartConnection: 소켓 새로 생성 완료", "LogWindow");

            Win32APIs.SendMsgData("tryConnection: 접속 시도", "LogWindow");
            try
            {
                conn.Connect(_serverIp, _serverPort);
            }
            catch (Exception e) {
                Win32APIs.SendMsgData("tryConnection: 접속 실패." + e.Message, "LogWindow");
                whenConnectionFailed(id);
                return;
            }
            Win32APIs.SendMsgData("tryConnection: 접속 시도 끝", "LogWindow");

            if (conn != null && conn.Client != null && conn.Connected == true)
            {
                Win32APIs.SendMsgData("tryConnection: 연결됨1", "LogWindow");
                ConnectionEvent(ConnType.Connected);
                Win32APIs.SendMsgData("tryConnection: 연결됨2", "LogWindow");
                //_isConnecting = false;
                if (_runRecvThreadWhenConnected)
                {
                    recvLoop();
                    //_checkConnectionThread.Abort();
                    //연결이 끊어지거나 문제가있어서 끝난 것. 후속처리..
                    if (_isDisposing == false)
                    {
                        whenConnectionFailed(id);
                    }
                    //끝나면 thread를 삭제해야 함..v
                }
            }
            else
            {
                whenConnectionFailed(id);
                return;
            }
            #region old

            /*
             * try
             * {
             *  while (_isConnecting)
             *  {
             *      if (_nowConn != null && _nowConn.Client.Connected)
             *      {
             *
             *          //_checkConnectionThread.Abort();
             *          break;// return;
             *      }
             *      else
             *      {
             *          if (_isDisposing == false)
             *          {
             *              try
             *              {
             *                  Win32APIs.SendMsgData("tryConnection: 접속 시도", "LogWindow");
             *                  _nowConn.Connect(_serverIp, _serverPort);
             *                  Win32APIs.SendMsgData("tryConnection: 접속 시도 끝", "LogWindow");
             *
             *                  if (_nowConn != null && _nowConn.Client != null && _nowConn.Connected == true)
             *                  {
             *                      Win32APIs.SendMsgData("tryConnection: 연결됨1", "LogWindow");
             *                      ConnectionEvent(ConnType.Connected);
             *                      Win32APIs.SendMsgData("tryConnection: 연결됨2", "LogWindow");
             *                      _isConnecting = false;
             *                      runRecvThread();
             *                      //_checkConnectionThread.Abort();
             *                  }
             *                  else
             *                  {
             *                      Win32APIs.SendMsgData("tryConnection:연결된 후 뭔가 잘못되었다.", "LogWindow");
             *                      if (_isPermarnentConnecting)
             *                      {
             *                          Win32APIs.SendMsgData("tryConnection:계속 접속모드: 재접속 호출", "LogWindow");
             *                          _connectionState = ConnType.Disconnected;
             *                          _isConnecting = false;
             *                          _connectionTimer.Start();
             *                          //if (_isDisposing == false) StartConnection(_connectionTimeout, _runRecvThreadWhenConnected);
             *
             *                          break;// return;
             *                      }
             *                      else
             *                      {
             *                          Win32APIs.SendMsgData("tryConnection:연결시도 마침.", "LogWindow");
             *                          _isConnecting = false;
             *                          ConnectionEvent(ConnType.Disconnected);
             *                          //_checkConnectionThread.Abort();
             *                      }
             *                  }
             *
             *              }
             *              catch (Exception e)
             *              {
             *                  Win32APIs.SendMsgData("tryConnection:CONNECTION 실패 1:" + e.Message + "재접속 시도", "LogWindow");
             *                  Win32APIs.SendMsgData("tryConnection:재접속시도", "LogWindow");
             *                  Thread.Sleep(1000);
             *                  if (_isPermarnentConnecting)
             *                  {
             *                      Win32APIs.SendMsgData("tryConnection:계속 접속모드: 재접속 호출", "LogWindow");
             *                      _connectionState = ConnType.Disconnected;
             *
             *                      //_isConnecting = false;
             *                      //_connectionTimer.Start();
             *                      if (_isDisposing == false) StartConnection(_connectionTimeout, _runRecvThreadWhenConnected);
             *                      break;
             *                  }
             *                  else
             *                  {
             *                      _isConnecting = false;
             *                      Win32APIs.SendMsgData("tryConnection:연결시도 마침.", "LogWindow");
             *                      ConnectionEvent(ConnType.Disconnected);
             *                      break;//return;
             *                  }
             *                  // _checkConnectionThread.Abort();
             *
             *              }
             *          }
             *          else
             *          {
             *              //_checkConnectionThread.Abort();
             *              break;// return;
             *          }
             *      }
             *  }
             * }
             * catch { }
             * _isConnecting = false;
             */
            #endregion
        }