Пример #1
0
 // Constructor for Clone
 private protected IPEndpoint(IPEndpoint endpoint, string host, ushort port)
     : base(endpoint.Communicator, endpoint.Protocol)
 {
     Host          = host;
     Port          = port;
     SourceAddress = endpoint.SourceAddress;
 }
Пример #2
0
        internal static Socket CreateServerSocket(IPEndpoint endpoint, AddressFamily family)
        {
            Socket socket = CreateSocket(endpoint.IsDatagram, family);

            if (family == AddressFamily.InterNetworkV6)
            {
                try
                {
                    socket.SetSocketOption(SocketOptionLevel.IPv6,
                                           SocketOptionName.IPv6Only,
                                           endpoint.IsIPv6Only ? 1 : 0);
                }
                catch (SocketException ex)
                {
                    socket.CloseNoThrow();
                    throw new TransportException(ex);
                }
            }
            return(socket);
        }