Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

help,I want to know about use master server.

Discussion in 'Multiplayer' started by nscyber, Jul 29, 2014.

  1. nscyber

    nscyber

    Joined:
    Jul 14, 2014
    Posts:
    22
    1.what is different of master server and unity networking api(not have master server,use public ip to connect) ?
    2.benefit of master server ?
    3.I want to see example of master server.
    4.I don't understand why we have to use the master server,when have unity networking api (use public ip to connect).

    - unity networking api(not have master server)
    If have initialize server public ip will save on database server ,on client open scene lobby client will see room(server1,server2,load form database) > join > play game .

    - have master server
    It same unity networking api,but don't use database server to save public ip.
    I can create one room(server),if other create new room(server,room2 or first),can't create new room.

    Thank you,I will wait for the answer for everyone.
     
  2. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
    Let's start with an example:
    Player A is on the same LAN as player B. Player A starts a server instance and player B can connect to it using player A's ip address. No master server is needed because they know eachother ip address to connect directly on the same LAN.
    Example 2:
    Player A starts a server in his LAN at home.
    Player B is connected to the internet at his home but doesn't know the ip address of player A.
    When player A starts the server instance, it will send it's public ip address to the master server.
    When player B wants to connect to player A, it will retrieve the ip address of player A from the master server and the master server (using the NAT facilitator) will provide NAT punchthrough if needed to make that connection possible.
     
    rasheedqw likes this.
  3. nscyber

    nscyber

    Joined:
    Jul 14, 2014
    Posts:
    22
    thank you.
    I found one problem(use master server).
    If have player A starts the server instance and player B starts the server instance,player C can connect to server player A but player D can't connect to server B.
    A(server) < C(connect to A) // can connect
    B(server) < D(connect to B)// can't connect
    E(server) < F(connect to B)// can't connect
    G(server) < H(connect to B)// can't connect
     
  4. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
    But why can't they connect?
    Did you debug the connection? Is the OnFailedToConnect called?
    What is the error?