Esempio n. 1
0
 public NWConnection(NWEndpoint endpoint, NWParameters parameters)
 {
     if (endpoint == null)
     {
         throw new ArgumentNullException(nameof(endpoint));
     }
     if (parameters == null)
     {
         throw new ArgumentNullException(nameof(parameters));
     }
     InitializeHandle(nw_connection_create(endpoint.Handle, parameters.Handle));
 }
Esempio n. 2
0
        public NWConnectionGroup(NWMulticastGroup groupDescriptor, NWParameters parameters)
        {
            if (groupDescriptor == null)
            {
                throw new ArgumentNullException(nameof(groupDescriptor));
            }
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            InitializeHandle(nw_connection_group_create(groupDescriptor.GetCheckedHandle(), parameters.GetCheckedHandle()));
        }
Esempio n. 3
0
        public static NWListener Create(NWParameters parameters)
        {
            IntPtr handle;

            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            handle = nw_listener_create(parameters.Handle);
            if (handle == IntPtr.Zero)
            {
                return(null);
            }
            return(new NWListener(handle, owns: true));
        }
Esempio n. 4
0
        public static NWListener Create(NWConnection connection, NWParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            var handle = nw_listener_create_with_connection(connection.Handle, parameters.Handle);

            if (handle == IntPtr.Zero)
            {
                return(null);
            }
            return(new NWListener(handle, owns: true));
        }