Search Unity

[SOLVED] How to disconnect a client from the Server in LLAPI?

Discussion in 'Multiplayer' started by TwoTen, Jul 26, 2017.

  1. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Hello! Title says it all.
    In HLAPI, it's really easy. Just find their NetworkIdentity. then get the connectionToClient and call Disconnect on it.

    But how can we do this in LLAPI?
     
  2. marcV2g

    marcV2g

    Joined:
    Jan 11, 2016
    Posts:
    115
    Does NetworkClient.allClients work in LLAPI?
     
  3. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Pretty sure NetworkClient is HLAPI.
     
  4. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Solution: NetworkTransport.Disconnect. I read the docs on it, but it seemed like the docs was suggesting that it only works for clients. But I decided to try it out and it did work.
     
  5. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Unet really is a mess and the docs for not much better on help.. but yeh I think NetworkTransport is pretty much the only part that is llapi in the UnityEngine.Networking that you can use, all the other areas in that seems to be hlapi stuff and no use.
     
  6. GameDevJon

    GameDevJon

    Joined:
    Jul 21, 2017
    Posts:
    25
    I handled this issue by having a list of connections on the network manager, and then waiting for OnDiscconectFromServer and removed the matching connection ID.
     
  7. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Can't disagree with you more too be honest. The HLAPI is so easy to use, and aslong as you understand your code and the basic concepts. It's super easy to use and I would say it's a wonderful place to start with Network Programming. What is such a mess about Unet? And what is so horribly wrong with the docs?
    Well, That's not what I wanted to do. I wanted do disconnect them from the server at the library level. Not pretend like they didn't exist.