/// <summary> /// Publishes the service information to the domain /// </summary> /// <param name="domain">The domain to publish to</param> /// <param name="type">The service type</param> /// <param name="name">The service name</param> /// <param name="port">The port being advertised</param> /// <returns><see cref="Mono.Zeroconf.RegisterService"/></returns> private Mono.Zeroconf.RegisterService Publish(string domain, string type, string name, int port) { Stop(); Mono.Zeroconf.TxtRecord txt = new Mono.Zeroconf.TxtRecord(); txt.Add("version", "1.0"); txt.Add("platform", "windows"); txt.Add("websocket", "13"); Mono.Zeroconf.RegisterService s = new Mono.Zeroconf.RegisterService(); s.Name = name; s.UPort = 23053; s.RegType = type; s.ReplyDomain = ""; s.TxtRecord = txt; s.Register(); return(s); }
/// <summary> /// Starts the Bonjour service that advertises this server /// </summary> /// <param name="port">The port the actual server is running on</param> internal void Start(int port) { if (isSupported && !isStarted) { try { this.service = Publish(DOMAIN, this.serviceType, this.serviceName, port); this.isStarted = true; } catch (Exception ex) { Growl.CoreLibrary.DebugInfo.WriteLine(String.Format("Bonjour service not published - {0}", ex.Message)); this.isStarted = false; } } }
public void Stop() { _started = false; if (_service != null) { _service.Dispose(); _service = null; } }
/// <summary> /// Stops advertising this server, and stops monitoring for other Bonjour services. /// </summary> internal void Stop() { if (this.isStarted) { if (this.service != null) { this.service.Dispose(); } this.service = null; this.isStarted = false; } }
public void Start() { if (_service == null && _advertise) { _service = new Mono.Zeroconf.RegisterService(); _service.Name = _name; _service.Port = _usePort; _service.RegType = "_tivo-hme._tcp"; _service.TxtRecord = new Mono.Zeroconf.TxtRecord(); _service.TxtRecord.Add("version", "0.40"); _service.TxtRecord.Add("path", ApplicationPrefix.AbsolutePath); _service.Register(); } _started = true; }
public void init_zeroconf() { browser = new Mono.Zeroconf.ServiceBrowser(); browser.ServiceAdded += delegate(object o, Mono.Zeroconf.ServiceBrowseEventArgs args) { bool added = reg_edit.AddPartnerEntry(args.Service.Name); string to_write = "Service found: " + args.Service.Name + " : " + added; Service1.WirteLog(to_write); }; browser.ServiceRemoved += delegate(object o, Mono.Zeroconf.ServiceBrowseEventArgs args) { bool removed = reg_edit.deletePartnerEntry(args.Service.Name); Service1.WirteLog("Service disconnected: " + args.Service.Name + " : " + removed); }; browser.Browse("_drop._tcp", "local"); service = new Mono.Zeroconf.RegisterService(); service.Name = "Drop windows"; service.RegType = "_drop._tcp"; service.ReplyDomain = "local."; service.Port = 7431; Mono.Zeroconf.TxtRecord txt = new Mono.Zeroconf.TxtRecord(); txt.Add("display-name", "Windows"); txt.Add("server-enabled", "true"); txt.Add("protocol-implementation", "windows"); txt.Add("unencrypted-port", "7432"); txt.Add("protocol-version", "1"); service.TxtRecord = txt; service.Register(); var protocol_test = new ProtocolImplementation("192.168.100.120"); }
/// <summary> /// Publishes the service information to the domain /// </summary> /// <param name="domain">The domain to publish to</param> /// <param name="type">The service type</param> /// <param name="name">The service name</param> /// <param name="port">The port being advertised</param> /// <returns><see cref="Mono.Zeroconf.RegisterService"/></returns> private Mono.Zeroconf.RegisterService Publish(string domain, string type, string name, int port) { Stop(); Mono.Zeroconf.TxtRecord txt = new Mono.Zeroconf.TxtRecord(); txt.Add("txtvers", "1"); txt.Add("platform", "windows"); Mono.Zeroconf.RegisterService s = new Mono.Zeroconf.RegisterService(); s.Name = name; s.UPort = 23053; s.RegType = type; s.ReplyDomain = ""; s.TxtRecord = txt; s.Register(); return s; }
/// <summary> /// Stops advertising this server, and stops monitoring for other Bonjour services. /// </summary> internal void Stop() { if (this.isStarted) { if (this.service != null) this.service.Dispose(); this.service = null; this.isStarted = false; } }
/// <summary> /// Starts the Bonjour service that advertises this server /// </summary> /// <param name="port">The port the actual server is running on</param> internal void Start(int port) { if(isSupported && !isStarted) { try { this.service = Publish(DOMAIN, this.serviceType, this.serviceName, port); this.isStarted = true; } catch(Exception ex) { Growl.CoreLibrary.DebugInfo.WriteLine(String.Format("Bonjour service not published - {0}", ex.Message)); this.isStarted = false; } } }