Exemple #1
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);
            }
        }
Exemple #2
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);
            }
        }