Exemplo n.º 1
0
        protected override void OnData(ArraySegment <byte> data)
        {
            var count = uv_pipe_pending_count(NativeHandle);

            if (count-- > 0)
            {
                var    type   = uv_pipe_pending_type(NativeHandle);
                Handle handle = null;
                switch (type)
                {
                case HandleType.UV_UDP:
                    handle = new Udp(Loop);
                    break;

                case HandleType.UV_TCP:
                    handle = new Tcp(Loop);
                    break;

                case HandleType.UV_NAMED_PIPE:
                    handle = new Pipe(Loop);
                    break;
                }
                if (handle != null)
                {
                    Invoke(NativeMethods.uv_accept, handle.NativeHandle);
                    OnHandleData(handle, data);
                }
            }
            base.OnData(data);
        }
Exemplo n.º 2
0
		internal BlockingUdp(Loop loop, Udp udp)
			: base(loop)
		{
			Udp = udp;
			Handle = udp;
		}