コード例 #1
0
        public static Udp ReceiveStart(this Udp udp,
                                       Action <Udp, IDatagramReadCompletion> receiveAction)
        {
            if (udp is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.udp);
            }
            if (receiveAction is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.receiveAction);
            }

            udp.OnReceive(receiveAction);
            udp.ReceiveStart();

            return(udp);
        }
コード例 #2
0
        public static Udp ReceiveStart(this Udp udp,
                                       IPEndPoint localEndPoint,
                                       Action <Udp, IDatagramReadCompletion> receiveAction,
                                       bool dualStack = false)
        {
            if (udp is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.udp);
            }
            if (localEndPoint is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.localEndPoint);
            }
            if (receiveAction is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.receiveAction);
            }

            udp.Bind(localEndPoint, dualStack);
            udp.OnReceive(receiveAction);
            udp.ReceiveStart();

            return(udp);
        }