AsterixDisplayAnalyser.AsterixReplay.LANReplay.Connect C# (CSharp) Метод

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

public static Connect ( string FilePath, IPAddress Interface_Addres_IN, IPAddress Multicast_Address_IN, int PortNumber_IN ) : bool
FilePath string
Interface_Addres_IN System.Net.IPAddress
Multicast_Address_IN System.Net.IPAddress
PortNumber_IN int
Результат bool
            public static bool Connect(string FilePath,                  // Path and file name 
                                        IPAddress Interface_Addres_IN,   // IP address of the interface where the data is expected
                                        IPAddress Multicast_Address_IN,  // Multicast address of the expected data
                                        int PortNumber_IN)
            {
                bool Result = true;

                // 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(Multicast_Address_IN, Interface_Addres_IN);
                    tx_iep = new IPEndPoint(Multicast_Address_IN, PortNumber_IN);
                }
                catch
                {
                    MessageBox.Show("LAN REPLAY: Not possible! Make sure given IP address/port is a valid one on your system or not already used by some other process");
                    Result = false;
                }

                // Open up data source file
                try
                {
                    TotalFileSizeBytes = new System.IO.FileInfo(FilePath).Length;
                    // Open file for reading
                    FileStream = new System.IO.FileStream(FilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read);

                    // attach filestream to binary reader
                    BinaryReader = new System.IO.BinaryReader(FileStream);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                }

                // Check if there is any data in the file
                if (TotalFileSizeBytes == 0)
                {
                    MessageBox.Show("Empty file, please select another one");
                    Result = false;
                }

                // If everything is OK so far set the status to connected
                if (Result == true)
                    SetStatus(ReplayStatus.Connected);

                return Result;
            }