Can iPhones 'discover' eachother?

Discussion in 'Mac Programming' started by RossOliver, May 9, 2008.

  1. RossOliver macrumors regular

    Joined:
    Nov 6, 2006
    #1
    Does the iPhone have any capability to 'discover' one another when several iPhones are in range?

    Just thinking about multilayer games and what not - I know the MacBooks can act as a wireless tansmitter as well as receiver; is this kind of thing possible with the iPhone? Maybe over Bluetooth?

    -Ross
     
  2. psingh01 macrumors 65816

    Joined:
    Apr 19, 2004
    #2
    I believe iPhone OS has Bonjour, which is what MacOSX uses for discovery services.
     
  3. RossOliver thread starter macrumors regular

    Joined:
    Nov 6, 2006
    #3
    That sounds like it could be used by a program to provide multi-user services, but I think the phone still needs the ability to make a physical link to another device. From what I can tell bonjour only allows discovery of services once the connection has been established, but doesn't deal with making the connection itself...
     
  4. psingh01 macrumors 65816

    Joined:
    Apr 19, 2004
    #4
    I have no clue how Bonjour works programatically (i.e. what type of information is available to you when you broadcast), but if you can broadcast your IP & listening port then a nearby iPhone can just open a socket connection there and you can start your game.
     
  5. Sayer macrumors 6502a

    Sayer

    Joined:
    Jan 4, 2002
    Location:
    Austin, TX
    #5
    There is an iPhone sample code project showing how to make a client/server "game" that was discoverable over wifi. Its called WiTap.
     
  6. RossOliver thread starter macrumors regular

    Joined:
    Nov 6, 2006
    #6
    Aha, excellent - I'll delve into the WiTap source and take a closer look at Bonjour :)

    Cheers

    [edit]

    Out of interest, how do you test networked applications? Can you run multiple iPhone Simulators somehow?
     
  7. psingh01 macrumors 65816

    Joined:
    Apr 19, 2004
    #7
    I shall have a look as well...:)

    Maybe multiple simulators or simulator + real iPhone. At the very least, you won't need another iPhone just to test your networking code. You can have the server be on the mac itself. Would be nice too if you want to play your game between iPhone and Desktop.
     

Share This Page