FishNet icon indicating copy to clipboard operation
FishNet copied to clipboard

Client connection error when using Multipass: This method is not supported. Use SetPort(port, transportIndex) instead.

Open emredesu opened this issue 1 year ago • 5 comments

General Unity version: 2021.3.28f1 Fish-Networking version: 3.10.8R Discord link: https://discord.com/channels/424284635074134018/1034477094731784302/1148317265159278642

Description The error in the title seems to pop-up when a client is connecting using Tugboat. The connection does happen without an issue, but the error still fires. I have attempted to fix it internally by directing the function that raises the error to the right function, but that actually caused the client connection to fail.

Replication Steps to reproduce the behavior:

  1. Set up a Multipass environment with at least 2 transports (I am using Tugboat and Yak)
  2. Start up a server
  3. Connect a client
  4. Experience the client connecting without a problem, but the error popping up

Expected behavior Either there should be no error since the client is able to connect without a problem, or something that is breaking in the background should be fixed (?)

Screenshots image

emredesu avatar Sep 04 '23 18:09 emredesu

How are you starting the client?

FirstGearGames avatar Sep 09 '23 00:09 FirstGearGames

How are you starting the client?

I first use Multipass.SetClientTransport(typeof(Tugboat/Yak)), and then connect using ClientManager.StartConnection(). I can't use Multipass.StartConnection(server: false) as I need to be able to supply an IP address when connecting to a server.

emredesu avatar Sep 09 '23 11:09 emredesu

Can you show the actual code you are using and a stack trace of the error please. You said you needed to specify address but you aren't passing it into your connect ClientManager.StartConnection(). I want to be sure I'm looking in the right places.

FirstGearGames avatar Sep 09 '23 19:09 FirstGearGames

Alright, he's as condensed as possible I got it to be:

Code:

   void Start() {
        HostOnlineMultiplayer();

        networkManager.ServerManager.OnServerConnectionState += OnOnlineServerInitComplete;
   }

    void OnOnlineServerInitComplete(ServerConnectionStateArgs args) {
        // server started successfully
        if (args.ConnectionState == LocalConnectionState.Started) {
            ConnectToOnlineMultiplayer("127.0.0.1"); // Connect to self
        }

        networkManager.ServerManager.OnServerConnectionState -= OnOnlineServerInitComplete;
    }

    public void HostOnlineMultiplayer() {
        multipass.StartConnection(server: true, GetIndexOfCurrentTransport());
    }

    public void ConnectToOnlineMultiplayer(string IPAddress) {
        multipass.SetClientTransport(typeof(Tugboat));

        networkManager.ClientManager.StartConnection(IPAddress);
    }

    public int GetIndexOfCurrentTransport() {
        switch (mainMenuBehaviour.multiplayerType) {
            case MultiplayerType.SINGLEPLAYER:
                return multipass.Transports.IndexOf(yak);
            case MultiplayerType.LOCAL_MULTIPLAYER:
            case MultiplayerType.ONLINE_MULTIPLAYER:
                return multipass.Transports.IndexOf(tugboat);
            default:
                Debug.LogWarning($"Transport data for multiplayer type {mainMenuBehaviour.multiplayerType} is not set. Returning the first transport.");
                return 0;
        }
    }

Stack trace:

This method is not supported. Use SetPort(port, transportIndex) instead.
UnityEngine.Debug:LogError (object)
FishNet.Managing.Logging.LevelLoggingConfiguration:LogError (string) (at Assets/FishNet/Runtime/Managing/Logging/LevelLoggingConfiguration.cs:131)
FishNet.Managing.NetworkManager:LogError (string) (at Assets/FishNet/Runtime/Managing/NetworkManager.Logging.cs:119)
FishNet.Transporting.Multipass.Multipass:SetPort (uint16) (at Assets/FishNet/Runtime/Transporting/Transports/Multipass/Multipass.cs:679)
FishNet.Managing.Client.ClientManager:StartConnection (string,uint16) (at Assets/FishNet/Runtime/Managing/Client/ClientManager.cs:280)
FishNet.Managing.Client.ClientManager:StartConnection (string) (at Assets/FishNet/Runtime/Managing/Client/ClientManager.cs:272)
TempNetworking:ConnectToOnlineMultiplayer (string) (at Assets/Scripts/Temp Scripts/TempMainMenu/TempNetworking.cs:102)
TempNetworking:OnOnlineServerInitComplete (FishNet.Transporting.ServerConnectionStateArgs) (at Assets/Scripts/Temp Scripts/TempMainMenu/TempNetworking.cs:88)
FishNet.Managing.Server.ServerManager:Transport_OnServerConnectionState (FishNet.Transporting.ServerConnectionStateArgs) (at Assets/FishNet/Runtime/Managing/Server/ServerManager.cs:508)
FishNet.Transporting.Multipass.Multipass:Multipass_OnServerConnectionState (FishNet.Transporting.ServerConnectionStateArgs) (at Assets/FishNet/Runtime/Transporting/Transports/Multipass/Multipass.cs:312)
FishNet.Transporting.Tugboat.Tugboat:HandleServerConnectionState (FishNet.Transporting.ServerConnectionStateArgs) (at Assets/FishNet/Runtime/Transporting/Transports/Tugboat/Tugboat.cs:169)
FishNet.Transporting.Tugboat.CommonSocket:SetConnectionState (FishNet.Transporting.LocalConnectionState,bool) (at Assets/FishNet/Runtime/Transporting/Transports/Tugboat/Core/CommonSocket.cs:38)
FishNet.Transporting.Tugboat.Server.ServerSocket:IterateIncoming () (at Assets/FishNet/Runtime/Transporting/Transports/Tugboat/Core/ServerSocket.cs:468)
FishNet.Transporting.Tugboat.Tugboat:IterateIncoming (bool) (at Assets/FishNet/Runtime/Transporting/Transports/Tugboat/Tugboat.cs:190)
FishNet.Transporting.Multipass.Multipass:IterateIncoming (bool) (at Assets/FishNet/Runtime/Transporting/Transports/Multipass/Multipass.cs:378)
FishNet.Managing.Transporting.TransportManager:IterateIncoming (bool) (at Assets/FishNet/Runtime/Managing/Transporting/TransportManager.cs:561)
FishNet.Managing.Timing.TimeManager:TryIterateData (bool) (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:1048)
FishNet.Managing.Timing.TimeManager:IncreaseTick () (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:708)
FishNet.Managing.Timing.TimeManager:<TickUpdate>g__MethodLogic|104_0 () (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:383)
FishNet.Managing.Timing.TimeManager:TickUpdate () (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:373)
FishNet.Transporting.NetworkReaderLoop:Update () (at Assets/FishNet/Runtime/Transporting/NetworkReaderLoop.cs:28)

emredesu avatar Sep 09 '23 19:09 emredesu

I've reviewed the issue and in your situation the error is indeed harmless. I've already started to make some improvements which will eliminate the error but they will not come until after 3.11.0.

This issue will remain open until the changes are complete.

FirstGearGames avatar Sep 11 '23 16:09 FirstGearGames