@Override
    protected Object doInBackground(Object[] params)
    {
        while (true)
        {
            // 변수 선언
            int timeOut = 0;

            if(params.length > 0)
            {
                // 변수 선언
                SocketChannel socketChannel = (SocketChannel)params[0];

                try
                {
                    if(_isConnected == false)
                    {
                        // 소켓 Open
                        socketChannel = SocketChannel.open();
                        socketChannel.configureBlocking(false);
                        socketChannel.connect(new InetSocketAddress(_ip, _port));

                        // 연결 확인
                        while ((Thread.interrupted() == false) && (socketChannel.finishConnect() == true))
                        {
                            if(timeOut > 25)
                            {
                                // 타임 아웃 발생
                                throw new Exception();
                            }
                            else
                            {
                               // 타임 아웃 증가
                                timeOut++;
                            }
                        }

                        // 통신 연결 완료
                        _isConnected = true;

                    }

                    // 연결 완료 시점 부터 수신
                    if(_isConnected == true)
                    {
                        // 변수 선언
                        ByteBuffer byteBuffer = ByteBuffer.allocate(4096);
                        String msg = "";

                        if (_socketChannel.read(byteBuffer) > 0)
                        {
                            // 버퍼 플립
                            byteBuffer.flip();

                            // 버퍼 스트링 전환
                            CharBuffer charBuffer = Charset.forName("UTF-8").decode(byteBuffer);
                            while (charBuffer.hasRemaining())
                            {
                                msg += charBuffer.get();
                            }

                            // 공백 제거
                            msg = msg.trim();

                            // 메모리 제거
                            charBuffer.clear();
                            byteBuffer.clear();
                        }

                        // StartCode, End Code 확인
                        if((_startCode.length() > 0) && (_endCode.length() > 0))
                        {
                            // Stat Code와 End Code 모두가 설정되었을 때
                        }
                    }
                    else
                    {
                        _socketChannel = null;
                    }
                }
                catch (Exception ex)
                {
                }
            }

            // 슬립
            try
            {
                Thread.sleep(200);
            }
            catch (Exception ex)
            {
            }
        }
    }


-------------------------------


깨끗함?