Ejemplo n.º 1
0
        public string FindLocalLanAddress(bool ipv6, Guid interfaceId)
        {
            testLogger.LogTrace("FindLocalLanAddress");
            string returnAddress = NetworkInterfaceDataPathTests.GetLanEndpoint(ipv6, interfaceId);

            testLogger.LogComment("FindLocalLanAddress: {0}", returnAddress);
            testLogger.LogTrace("FindLocalLanAddress Length: {0}", returnAddress.Length);
            return(returnAddress);
        }
Ejemplo n.º 2
0
        public void Configure(TestMode testMode, Guid localInterfaceGuid, string address, bool ipv6, UInt16 port)
        {
            this.ipv6Mode = ipv6;
            localPort     = port;

            if (testMode == TestMode.Wlan)
            {
                localAddress = NetworkInterfaceDataPathTests.GetWirelessEndpoint(ipv6Mode);
            }
            else
            {
                localAddress = NetworkInterfaceDataPathTests.GetLanEndpoint(ipv6Mode, localInterfaceGuid);
            }

            this.identifier = String.Format(CultureInfo.InvariantCulture, "{0}:{1}", localAddress, localPort);
            testLogger.LogComment("MulticastReceiver[{0}]  local address", this.identifier);


            testLogger.LogTrace("Creating Multicast Receive Socket");
            if (ipv6Mode)
            {
                if (testMode == TestMode.Wlan)
                {
                    using (Wlan wlanApi = new Wlan())
                    {
                        var wlanInterfaceList = wlanApi.EnumWlanInterfaces();
                        if (wlanInterfaceList.Count < 1)
                        {
                            throw new TestConfigException("No WLAN Interfaces were discovered.  Ensure that WLAN interfaces are enabled, discoverable, and operational.");
                        }
                        var wlanInterface = wlanInterfaceList[0];

                        UInt32 wlanInterfaceIndex = NetworkInterfaceDataPathTests.GetNetworkIndex(wlanInterface.Id);
                        listenSocket = sockets.CreateMulticastSocket(localAddress, localPort, address, port, wlanInterfaceIndex);
                    }
                }
                else
                {
                    UInt32 lanInterfaceIndex = NetworkInterfaceDataPathTests.GetNetworkIndex(localInterfaceGuid);
                    listenSocket = sockets.CreateMulticastSocket(localAddress, localPort, address, port, lanInterfaceIndex);
                }
            }
            else
            {
                listenSocket = sockets.CreateMulticastSocket(localAddress, localPort, address, port);
            }
        }
Ejemplo n.º 3
0
        public void Configure(TestMode testMode, Guid localInterfaceGuid, string address, bool ipv6, UInt16 port)
        {
            this.ipv6Mode = ipv6;
            localPort     = port;

            if (testMode == TestMode.Wlan)
            {
                localAddress = NetworkInterfaceDataPathTests.GetWirelessEndpoint(ipv6Mode);
            }
            else
            {
                localAddress = NetworkInterfaceDataPathTests.GetLanEndpoint(ipv6Mode, localInterfaceGuid);
            }
            this.identifier = String.Format(CultureInfo.InvariantCulture, "{0}:{1}", localAddress, localPort);
            testLogger.LogComment("BroadcastReceiver[{0}] local address", this.identifier);

            listenSocket = sockets.CreateUdpSocket(localAddress, localPort, ipv6Mode);
        }
Ejemplo n.º 4
0
        public void Configure(TestMode testMode, Guid localInterfaceGuid, string address, bool ipv6, UInt16 port)
        {
            this.ipv6Mode      = ipv6;
            this.remoteAddress = address;
            this.remotePort    = port;
            localPort          = port;

            if (testMode == TestMode.Wlan)
            {
                localAddress = NetworkInterfaceDataPathTests.GetWirelessEndpoint(ipv6Mode);
            }
            else
            {
                localAddress = NetworkInterfaceDataPathTests.GetLanEndpoint(ipv6Mode, localInterfaceGuid);
            }
            this.identifier = String.Format(CultureInfo.InvariantCulture, "{0}:{1}", localAddress, localPort);

            testLogger.LogComment("BroadcastSender[{0}]  Remote {1}:{2}", this.identifier, this.remoteAddress, this.remotePort);
        }