Search Unity

Help Wanted How to handle maximum connection count?

Discussion in 'Unity Transport' started by Kichang-Kim, May 26, 2021.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    720
    Hi, WIth old LLAPI, there is HostTopology class for configuring maximum connection count for server. But I found that Unity Transport does not have any API for that.

    How to handle maximum connection count for Unity Transport? should I manually disconnect it after NetworkDriver.Accept()? or should not call NetworkDriver.Accept() while connection count reached to max?

    Thanks.
     
  2. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    386
    I would recommend Accept + Disconnect. The connections are actually accepted by the NetworkDriver update job and stored in a queue of new connections. The Accept method simply pops from that queue, which means the connection is established and receiving events which you must process even if you do not call accept.
     
    Kichang-Kim likes this.
unityunity