AsterixDisplayAnalyser.RecForwConnection6.StartForward C# (CSharp) Метод

StartForward() публичный статический Метод

public static StartForward ( IPAddress Interface_Addres, IPAddress Multicast_Address, int PortNumber, IPAddress Frwd_Interface_Addres, IPAddress Frwd_Multicast_Address, int Frwd_PortNumber ) : bool
Interface_Addres System.Net.IPAddress
Multicast_Address System.Net.IPAddress
PortNumber int
Frwd_Interface_Addres System.Net.IPAddress
Frwd_Multicast_Address System.Net.IPAddress
Frwd_PortNumber int
Результат bool
        public static bool StartForward(IPAddress Interface_Addres,  // IP address of the interface where the data is expected
                                       IPAddress Multicast_Address, // Multicast address of the expected data
                                       int PortNumber,
                                       IPAddress Frwd_Interface_Addres,  // IP address of the forward interface 
                                       IPAddress Frwd_Multicast_Address, // Multicast address of the forwarded data
                                       int Frwd_PortNumber)
        {
            // Open up outgoing socket
            // Open up a new socket with the net IP address and port number
            try
            {
                tx_sock = new UdpClient();
                tx_sock.JoinMulticastGroup(Frwd_Multicast_Address, Frwd_Interface_Addres);
                tx_iep = new IPEndPoint(Frwd_Multicast_Address, Frwd_PortNumber);
            }
            catch
            {
                MessageBox.Show("Not possible! Make sure given IP address/port is a valid one on your system or not already used by some other process");
                return false;
            }

            // Check if recording is already in place, if so then
            // do not create a new incoming connection
            if (IsConnectionActive() == false)
            {
                // Open up a new socket with the net IP address and port number
                try
                {
                    rcv_sock = new UdpClient(PortNumber);
                    rcv_sock.JoinMulticastGroup(Multicast_Address, Interface_Addres);
                    rcv_iep = new IPEndPoint(IPAddress.Any, PortNumber);
                }
                catch
                {
                    MessageBox.Show("Not possible! Make sure given IP address/port is a valid one on your system or not already used by some other process");
                    return false;
                }

                KeepGoing = true;
                RequestStop = false;
                ListenForDataThread = new Thread(new ThreadStart(DOWork));
                ListenForDataThread.Start();
            }

            ForwardingEnabled = true;
            return true;
        }