Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 3
0
        /// <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;
        }