Retrieve() public abstract method

public abstract Retrieve ( int size ) : ArraySegment
size int
return ArraySegment
Ejemplo n.º 1
0
        void rcallback(IntPtr streamPointer, IntPtr size)
        {
            long nread = size.ToInt64();

            if (nread == 0)
            {
                return;
            }
            else if (nread < 0)
            {
                if (UVException.Map((int)nread) == UVErrorCode.EOF)
                {
                    Close(Complete);
                }
                else
                {
                    OnError(Ensure.Map((int)nread));
                    Close();
                }
            }
            else
            {
                OnData(ByteBufferAllocator.Retrieve(size.ToInt32()));
            }
        }
Ejemplo n.º 2
0
        internal void read_callback(IntPtr stream, IntPtr size)
        {
            long nread = size.ToInt64();

            if (nread == 0)
            {
                return;
            }
            else if (nread < 0)
            {
                if (nread == (long)uv_err_code.UV_EOF)
                {
                    Close(Complete);
                }
                else
                {
                    OnError(Ensure.Map((int)nread));
                    Close();
                }
            }
            else
            {
                OnData(ByteBufferAllocator.Retrieve(size.ToInt32()));
            }
        }
Ejemplo n.º 3
0
        internal void recv_start_callback(IntPtr handle, IntPtr nread, IntPtr sockaddr, ushort flags)
        {
            int n = (int)nread;

            if (n == 0)
            {
                return;
            }

            if (Message != null)
            {
                var ep = UV.GetIPEndPoint(sockaddr);

                if (dualstack && ep.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6)
                {
                    var data = ep.Address.GetAddressBytes();
                    if (IsMapping(data))
                    {
                        ep = new IPEndPoint(GetMapping(data), ep.Port);
                    }
                }

                var msg = new UdpReceiveMessage(
                    ep,
                    ByteBufferAllocator.Retrieve(n),
                    (flags & (short)uv_udp_flags.UV_UDP_PARTIAL) > 0
                    );

                Message(msg);
            }
        }
Ejemplo n.º 4
0
        void recv_start_callback(IntPtr handle, IntPtr nread, IntPtr sockaddr, ushort flags)
        {
            int n = (int)nread;

            if (n == 0)
            {
                return;
            }

            if (Message != null)
            {
                var ep = UV.GetIPEndPoint(sockaddr, true);

                var msg = new UdpReceiveMessage(
                    ep,
                    ByteBufferAllocator.Retrieve(n),
                    (flags & (short)uv_udp_flags.UV_UDP_PARTIAL) > 0
                    );

                Message(msg);
            }
        }