Example #1
0
        public int Receive(Buffers buff, out SocketError socketError, SocketFlags socketFlags = SocketFlags.None)
        {
            try
            {
                int ret = socket.Receive(buff.GetBuff(), buff.GetNextWritableEnd(), buff.GetWriteContinuedSize(),
                                         socketFlags, out socketError);
                if (ret > 0)
                {
                    buff.SetEndByLen(ret);
                }

                return(ret);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                socketError = SocketError.SocketError;
                return(-1);
            }
        }