예제 #1
0
        public bool SendData(IDataSession session, string request, ref int pos)
        {
            var end   = request.IndexOf(Eofpattern, pos);
            var begin = pos;
            var eof   = true;

            if (end == -1)
            {
                eof = false;
                pos = request.Length;
                end = request.Length;
            }
            else
            {
                pos = end + Eofpattern.Length;
            }

            var data = GetData(request, begin, end);

            if (data.Length != 0)
            {
                session.Send(data);
            }

            if (eof)
            {
                session.EndSend();
                SendResponse("OK");

                return(true);
            }

            return(false);
        }