Professional Web Applications Themes

NSDistributedNotificationCenter : string to use ? - Mac Programming

This is not really appropriate for comp.lang.objective-c, since it's a Cocoa problem and doesn't really have anything to do with Objective-C. I've crossposted to comp.sys.mac.programmer.help and set Followup-To: accordingly. In article <3ff1d352$0$1166$free.fr>, Jean-Michel MARINO <fr> wrote:   What are you trying to do? NSDistributedNotificationCenter isn't a magical way to get notified about random activity in the system. You only get notifications that were also *sent* with NSDistributedNotificationCenter. Your callback will recieve all notifications that have the name and object that you registered for. So to answer the question, which string should you use? If you're communicating with your own code, ...

  1. #1

    Default Re: NSDistributedNotificationCenter : string to use ?

    This is not really appropriate for comp.lang.objective-c, since it's a
    Cocoa problem and doesn't really have anything to do with Objective-C.
    I've crossposted to comp.sys.mac.programmer.help and set Followup-To:
    accordingly.

    In article <3ff1d352$0$1166$free.fr>,
    Jean-Michel MARINO <fr> wrote:
     

    What are you trying to do? NSDistributedNotificationCenter isn't a
    magical way to get notified about random activity in the system. You
    only get notifications that were also *sent* with
    NSDistributedNotificationCenter. Your callback will recieve all
    notifications that have the name and object that you registered for.

    So to answer the question, which string should you use? If you're
    communicating with your own code, it's entirely up to you. You need to
    make sure of two things: first, the strings must be the same in the
    sender and the reciever; second, the strings must be unique on the
    system. To make sure of that second one, it's a good idea to include
    your bundle identifier in the object string.

    If you're trying to recieve notifications from other programs, then you
    should use the name and object strings that are doented for their
    notifications.

    If you're trying to recieve notifications about changes to a preferences
    file or something like that, that is not what
    NSDistributedNotificationCenter does. If you want to find out when a
    file changes, you should either poll it or have a look at kqueues if you
    can use Panther-only code.
    Michael Guest

  2. #2

    Default Re: NSDistributedNotificationCenter : string to use ?

    Michael Ash a écrit : 
    >
    >
    > What are you trying to do? NSDistributedNotificationCenter isn't a
    > magical way to get notified about random activity in the system. You
    > only get notifications that were also *sent* with
    > NSDistributedNotificationCenter. Your callback will recieve all
    > notifications that have the name and object that you registered for.
    >
    > So to answer the question, which string should you use? If you're
    > communicating with your own code, it's entirely up to you. You need to
    > make sure of two things: first, the strings must be the same in the
    > sender and the reciever; second, the strings must be unique on the
    > system. To make sure of that second one, it's a good idea to include
    > your bundle identifier in the object string.
    >
    > If you're trying to recieve notifications from other programs, then you
    > should use the name and object strings that are doented for their
    > notifications.[/ref]

    Does 'Network Pref Panel' sent a notification and if it do this what's
    string use ?

    All prefPanel sent notification yes or no ?

    If yes, why Apple don't distribute a list of notification to use for
    developer ?

    If Apple don't use NSDistributedNotificationCentre for 'System
    Preference' why are there examples say to use it ?

    I don't understand !!!
     


    --

    JMM ;-)

    ---- replace 'spam_killer' by 'free' to reply, thanks ----
    ---- remplacer 'spam_killer' par 'free' merci ----

    Jean-Michel Guest

  3. #3

    Default Re: NSDistributedNotificationCenter : string to use ?

    On Wed, 31 Dec 2003, Jean-Michel MARINO wrote:
     

    I have no idea if it sends notifications. It probably is not doented to
    send notifications, and so you should not rely on it in any case.
     

    No.
     

    The examples are for YOUR pref panes to communicate with YOUR apps. The
    idea isn't to send out notifications for anybody, it's so that your own
    software modules can communicate with each other.

    Again, what are you trying to do?
    Mike Guest

  4. #4

    Default Re: NSDistributedNotificationCenter : string to use ?

    Mike Ash a écrit : 
    >
    >
    > I have no idea if it sends notifications. It probably is not doented to
    > send notifications, and so you should not rely on it in any case.
    >

    >
    >
    > No.
    >

    >
    >
    > The examples are for YOUR pref panes to communicate with YOUR apps. The
    > idea isn't to send out notifications for anybody, it's so that your own
    > software modules can communicate with each other.[/ref]

    Many thanks for your answer, this is more lucid now.
     

    So, if I wan't to know when the user change (via Network Pref Panel) IP
    address it's not the good way ?!

    What can I do so ?
    - look if pref file change ?
    - read IP address with a timer in my app ?


    --

    JMM ;-)

    ---- replace 'spam_killer' by 'free' to reply, thanks ----
    ---- remplacer 'spam_killer' par 'free' merci ----

    Jean-Michel Guest

  5. #5

    Default IP address change notification (Was: NSDistributedNotificationCenter : string to use ?)

    In article <3ff48e80$0$22334$free.fr>,
    Jean-Michel MARINO <fr> wrote:
     
    >
    > Many thanks for your answer, this is more lucid now.[/ref]

    Good! :)
     
    >
    > So, if I wan't to know when the user change (via Network Pref Panel) IP
    > address it's not the good way ?!
    >
    > What can I do so ?
    > - look if pref file change ?
    > - read IP address with a timer in my app ?[/ref]

    I'm not sure how you could do this. (I changed the subject line so it
    might catch the attention of someone who does know.) However, you
    shouldn't do it by looking at the Network pref pane, or any files that
    it keeps its preferences in. The system IP addresses (can be more than
    one, don't forget) can change through a number of different ways, such
    as using 'ifconfig' in Terminal, or simply via DHCP. Polling for changes
    is the only way that I know of, but I don't know a lot about this.
    Hopefully someone else can come up with a better solution.
    Michael Guest

  6. #6

    Default Re: IP address change notification (Was: NSDistributedNotificationCenter

    On Thu, 1 Jan 2004, Michael Ash wrote:
     
    > >
    > > Many thanks for your answer, this is more lucid now.[/ref]
    >
    > Good! :)

    > >
    > > So, if I wan't to know when the user change (via Network Pref Panel) IP
    > > address it's not the good way ?!
    > >
    > > What can I do so ?
    > > - look if pref file change ?
    > > - read IP address with a timer in my app ?[/ref]
    >
    > I'm not sure how you could do this. (I changed the subject line so it
    > might catch the attention of someone who does know.) However, you
    > shouldn't do it by looking at the Network pref pane, or any files that
    > it keeps its preferences in. The system IP addresses (can be more than
    > one, don't forget) can change through a number of different ways, such
    > as using 'ifconfig' in Terminal, or simply via DHCP. Polling for changes
    > is the only way that I know of, but I don't know a lot about this.
    > Hopefully someone else can come up with a better solution.
    >[/ref]

    I believe that the system configuration framework may be your friend, more
    specifically the dynamic store.
    Basically, loads of stuff liable to change all the time like host names,
    proxy settings, location etc. is stored in the dynamic store. You can
    either query the store directly or install a callback with a list of keys
    you are interested in.

    The whole bunch is doented here:
    http://developer.apple.com/doentation/Networking/Conceptual/SysConfigOverview926/index.html
    Fred

    Frederick Guest

  7. #7

    Default Re: IP address change notification

    Jean-Michel MARINO <fr> wrote: 

    i'd say that whatever it is you're trying to do, you're probably going
    about it the wrong way. think of how often something like that can
    change: i disconnect my powerbook from my local ethernet network, it
    loses its ip address. i take it to a cyber-cafe, it gets a new ip
    address via a different interface. it might have both of those at once,
    as well as another via bluetooth or dial-up or whatever-the-heck-else.

    so you should probably say whatever it is you are REALLY trying to do,
    because keeping track of the comings and goings of a computer's ip
    addresses is a losing battle, to say the least.
    Jøhnny Guest

  8. #8

    Default Re: IP address change notification

    Jøhnny Fävòrítê (it means "genetic antagonism") <com>
    wrote:
     
    >
    > i'd say that whatever it is you're trying to do, you're probably going
    > about it the wrong way. think of how often something like that can
    > change: i disconnect my powerbook from my local ethernet network, it
    > loses its ip address. i take it to a cyber-cafe, it gets a new ip
    > address via a different interface. it might have both of those at once,
    > as well as another via bluetooth or dial-up or whatever-the-heck-else.
    >
    > so you should probably say whatever it is you are REALLY trying to do,
    > because keeping track of the comings and goings of a computer's ip
    > addresses is a losing battle, to say the least.[/ref]

    In many cases the best thing to do is to query the system for the IP
    address whenever you actually need it.

    Per
    Per Guest

  9. #9

    Default Re: IP address change notification (Was: NSDistributedNotificationCenter : string to use ?)

    In article <mail-9F7645.23114201012004localhost>, com
    says... 
    >[/ref]

    Here's a technote with sample code that does what you want:
    <http://developer.apple.com/technotes/tn/tn1145.html#CallingAllIPs>
    James Guest

  10. #10

    Default Re: IP address change notification (Was: NSDistributedNotificationCenter

    James Weatherley a écrit :
     
    >>[/ref]
    >
    > Here's a technote with sample code that does what you want:
    > <http://developer.apple.com/technotes/tn/tn1145.html#CallingAllIPs>[/ref]

    Thanks for reply, it's OK with this good technote.

    --

    JMM ;-)

    ---- replace 'spam_killer' by 'free' to reply, thanks ----
    ---- remplacer 'spam_killer' par 'free' merci ----

    Jean-Michel Guest

Similar Threads

  1. Replies: 1
    Last Post: February 27th, 12:04 AM
  2. NSDistributedNotificationCenter not working
    By Lorenzo in forum Mac Programming
    Replies: 5
    Last Post: December 20th, 09:33 PM
  3. #7056 [Com]: Setting string variables to value starting with '<' cause string to be empty.
    By davidgjenkins at ntlworld dot com in forum PHP Development
    Replies: 1
    Last Post: October 27th, 06:54 AM
  4. Replies: 2
    Last Post: August 16th, 10:26 AM
  5. Replies: 4
    Last Post: August 14th, 06:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139