/// <summary>Starts the specified server end points.</summary> /// <exception cref="Exception">Already started!</exception> /// <exception cref="ObjectDisposedException">Broadcaster</exception> /// <exception cref="ArgumentOutOfRangeException">serverEndPoints - Please define ServerEndpoints!</exception> /// <exception cref="InvalidDataException">Configuration data exceeds limits. Please reduce the number of ip/port combinations we listen at or disable ipv6 support.</exception> public void Start() { if (config != null) { throw new Exception("Already started!"); } if (Disposed) { throw new ObjectDisposedException("Broadcaster"); } writer.WriteSetting("MDB", "Version", "4.0"); writer.WriteSetting("MDB", "Host", mdb.Host.Name); writer.WriteSetting("MDB", "Streams", 7500); writer.WriteSection("Ports", mdb.Host.WebPort.ToString()); writer.WriteSetting("MDB", "WebPort", mdb.Host.WebPort); writer.WriteSetting("MDB", "FtpPort", mdb.Host.FtpPort); UpdateConfig(); sock = new MDBBroadcastSocket(BroadcastPort, true); sock.Received += SendAnswer; this.LogInfo("Answering broadcasts at port {0}", BroadcastPort); }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { Disposed = true; sock?.Dispose(); sock = null; }