public static void Main()
{
Application.Init();
// Register a sample service
RegisterService service = new RegisterService("Fruity Music", null, "_daap._tcp");
TxtRecord record = new TxtRecord();
record.Add("A", "Apples");
record.Add("B", "Bananas");
record.Add("C", "Carrots");
service.Port = 8080;
service.TxtRecord = record;
service.RegisterAsync();
// Listen for events of some service type
ServiceBrowser browser = new ServiceBrowser("_daap._tcp");
browser.ServiceAdded += OnServiceAdded;
browser.ServiceRemoved += OnServiceRemoved;
browser.StartAsync();
// Unregister our service in 10 seconds
GLib.Timeout.Add(10000, delegate {
service.Dispose();
return false;
});
// Stop browsing and quit in 15 seconds
GLib.Timeout.Add(15000, delegate {
browser.Dispose();
Application.Quit();
return false;
});
Application.Run();
}