private void OnRegisterReply(ServiceRef sdRef, ServiceFlags flags, ServiceError errorCode,
                                     string name, string regtype, string domain, IntPtr context)
        {
            RegisterServiceEventArgs args = new RegisterServiceEventArgs();

            args.Service      = this;
            args.IsRegistered = false;
            args.NameConflict = false;
            args.Error        = errorCode;

            if (errorCode == ServiceError.NoError)
            {
                Name              = name;
                RegType           = regtype;
                ReplyDomain       = domain;
                args.IsRegistered = true;
            }
            else if (errorCode == ServiceError.NameConflict)
            {
                args.NameConflict = true;
            }

            RegisterServiceEventHandler handler = Response;

            if (handler != null)
            {
                handler(this, args);
            }
        }
Example #2
0
 private static void OnRegisterServiceResponse(object o, RegisterServiceEventArgs args)
 {
     switch (args.ServiceError)
     {
         case ServiceErrorCode.NameConflict:
             Console.WriteLine("*** Name Collision! '{0}' is already registered",
                 args.Service.Name);
             break;
         case ServiceErrorCode.None:
             Console.WriteLine("*** Registered name = '{0}'", args.Service.Name);
             break;
         case ServiceErrorCode.Unknown:
             Console.WriteLine("*** Error registering name = '{0}'", args.Service.Name);
             break;
     }
 }
Example #3
0
        private void HandleServiceResponse(object o, RegisterServiceEventArgs args)
        {
            switch (args.ServiceError) {
            case ServiceErrorCode.NameConflict:
                Console.Error.WriteLine ("*** Name Collision! '{0}' is already registered", args.Service.Name);
                break;
            case ServiceErrorCode.None:
                Console.Error.WriteLine ("*** Registered name = '{0}'", args.Service.Name);
                break;
            case ServiceErrorCode.Unknown:
                Console.Error.WriteLine ("*** Error registering name = '{0}'", args.Service.Name);
                break;
            }

            //IContentEncoder cp = new HelloWorldContentEncoder ();
              		IContentEncoder cp = new StdinContentEncoder ();
            cp.Encode (new IPEndPoint (IPAddress.Any, args.Service.Port));
              		Running = false;
            Console.Error.WriteLine ("*** Unregistering service");
            service.Dispose ();
        }
Example #4
0
 private void OnRegisterServiceResponse(object o, RegisterServiceEventArgs args)
 {
     if (args.ServiceError == ServiceErrorCode.AlreadyRegistered && Collision != null) {
         Collision (this, new EventArgs ());
     }
 }
 async void netservice_Response(object o, RegisterServiceEventArgs args)
 {
     await Log.ReportInfoFormatAsync(CancellationToken, "Published Service: isRegistered:{0},  type: {1} name:{2}", args.IsRegistered, args.Service.RegType, args.Service.Name);
 }
Example #6
0
 void rs_Response(object o, RegisterServiceEventArgs args)
 {
     Console.WriteLine("Registered? {0}, Error Code: {1}", args.IsRegistered ? "Yes" : "No", args.ServiceError);
 }
        private void OnRegisterReply(ServiceRef sdRef, ServiceFlags flags, ServiceError errorCode,
            string name, string regtype, string domain, IntPtr context)
        {
            RegisterServiceEventArgs args = new RegisterServiceEventArgs();

            args.Service = this;
            args.IsRegistered = false;
            args.NameConflict = false;
            args.Error = errorCode;

            if(errorCode == ServiceError.NoError) {
                Name = name;
                RegType = regtype;
                ReplyDomain = domain;
                args.IsRegistered = true;
            } else if(errorCode == ServiceError.NameConflict) {
                args.NameConflict = true;
            }

            RegisterServiceEventHandler handler = Response;
            if(handler != null) {
                handler(this, args);
            }
        }
 void service_Response(object o, RegisterServiceEventArgs args)
 {
 }