private void ProcessReceive(object sender, SocketAsyncEventArgs e)
        {
            CToken token = e.UserToken as CToken;

            if (e.LastOperation == SocketAsyncOperation.Receive)
            {
                if (e.BytesTransferred > 0 && e.SocketError == SocketError.Success)
                {
                    token.OnReceive(e.Buffer, e.Offset, e.BytesTransferred);

                    if (token.isComplete == true)
                    {
                        Console.WriteLine("받을거 다 받았습니다.");

                        Send(token);
                        return;
                    }

                    bool pending = token.client.ReceiveAsync(e);

                    if (pending == false)
                    {
                        ProcessReceive(null, e);
                    }
                }
                else
                {
                    token.client.Close();
                }
            }
        }
        private void Receive(CToken token)
        {
            // 이부분처럼 버퍼를 셋 안해주면 오류 발생함.
            //token.receive_args.SetBuffer(new byte[1024], 0, 1024);
            //token.receive_args.UserToken = token;

            bool pending = token.client.ReceiveAsync(token.receive_args);

            if (pending == false)
            {
                ProcessReceive(null, token.receive_args);
            }
        }
        private void Send(CToken token)
        {
            List <ArraySegment <byte> > list = new List <ArraySegment <byte> >();

            list.Add(new ArraySegment <byte>(Encoding.ASCII.GetBytes(token.token)));
            list.Add(new ArraySegment <byte>(Encoding.ASCII.GetBytes(token.port)));

            token.send_args.BufferList = list;
            //token.send_args.UserToken = token;

            bool pending = token.client.SendAsync(token.send_args);

            if (pending == false)
            {
                ProcessSend(null, token.send_args);
            }
        }
        private void ProcessAccept(object sender, SocketAsyncEventArgs e)
        {
            if (e.SocketError == SocketError.Success)
            {
                Console.WriteLine("Success to connect");

                Socket client = e.AcceptSocket;
                SocketAsyncEventArgs receive_args = receive_args_pool.Pop();
                SocketAsyncEventArgs send_args    = send_args_pool.Pop();

                CToken token = new CToken(e.AcceptSocket, receive_args, send_args);
                receive_args.UserToken = token;
                send_args.UserToken    = token;

                Receive(token);
            }
            else
            {
                Console.WriteLine("Fail to Connect");
            }

            accept_event_control.Set();
        }