Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[LLAPI] NetworkTransport.RemoveHost always returns false

Discussion in 'Multiplayer' started by Ghosthowl, Jun 17, 2015.

  1. Ghosthowl

    Ghosthowl

    Joined:
    Feb 2, 2014
    Posts:
    228
    Whenever I want to shutdown the transport layer, I call this function, but I've never seen it return true. I figure I don't know enough to know how to or when to use it.

    For termination of the host I do the following:

    Code (csharp):
    1.  
    2.   public bool Shutdown()
    3.   {
    4.   if (NetworkTransport.RemoveHost(socketId))
    5.   {
    6.   NetworkTransport.Shutdown();
    7.   SocketLog.Info("Unbinding socket {0} : {1} | Host: {2}", SocketEndPoint.Address, SocketEndPoint.Port, socketId);
    8.   return true;
    9.   }
    10.   //Shutdown even if we fail unbinding
    11.   NetworkTransport.Shutdown();
    12.   SocketLog.Error("Failed to unbind socket {0} : {1} | Host: {2}", SocketEndPoint.Address, SocketEndPoint.Port, socketId);
    13.   return false;
    14.   }
    15.  
    socketId is set by AddHost().
     
  2. Ghosthowl

    Ghosthowl

    Joined:
    Feb 2, 2014
    Posts:
    228
    This seems to have been fixed in 5.1.1p4, as it is now returning true and working as expected.