Search Unity

Network Discovery interference and multiple host ip capture

Discussion in 'Multiplayer' started by freaky_squid, Mar 23, 2017.

  1. freaky_squid

    freaky_squid

    Joined:
    Mar 12, 2017
    Posts:
    4
    Hello, I have made 2 unity apps: The first is a game and the second is a controller to use the smartphone as the input device for the game. Everything works perfectly when I enter the game's ip manually into the controller app.

    But I want to use Network Discovery to find all games on the local network and display them to the user in a list so that he can click on the game that he wants to join.

    When I start 2 instances of the game, they each broadcast a different message (the device name).

    My first problem is that the 2 messages get scrambled when I display them in the onReceiveBroadcast method.

    For example:
    1st message is "ASUS Laptop" and 2nd message is "OnePlus One"
    When I print the data it displays "ASUS Laptop" then "OnePlus Laptop"

    My second problem is how to get a list of the games available at a certain point in time to display it (because the onReceiveBroadcast method returns 1 broadcast at a time and not a list).

    Thank you.
     
  2. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    So far no way to implement exactly what you want. You can
    (1) use different ports for different devices.
    (2) Use collect server which will broadcast (I collecting server if you device which want broadcast your name connect to me please)
    (3) Every time when you receive broadcast in your scenario, check if this device exists in your hash map, and add device in the map or drop message
     
  3. dhami-nitin

    dhami-nitin

    Joined:
    Jun 5, 2016
    Posts:
    8
    Hi, I am also looking for an exact same solution like yours were you able to make any progress?