"Failed to connect to server after testing each known IP." on Universal Windows Platform

I'm seeing the following error attempting to connect to a server using latest versions of the plugin on Unity 2019.2 and 2019.3 when built in a Universal Windows Platform application:

Failed to connect to server after testing each known IP. Error(s):
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
Photon.Realtime.LoadBalancingClient:DebugReturn(DebugLevel, String)
ExitGames.Client.Photon.<>c__DisplayClass104_0:<EnqueueDebugReturn>b__0()

I have set the AppId, AppVersion=1, Fixed Region=us. I reinstalled the plugin and then put it into a "hello world" minrepro, and it still occurs after calling ConnectUsingSettings(). I verified that the PhotonNetwork.PhotonServerSettings.AppSettings.* values contain the expected values before the call. I'm not sure of the next steps to debug this issue?

LogVerbose($"App ID: {PhotonNetwork.PhotonServerSettings.AppSettings.AppIdRealtime}");
LogVerbose($"Region: {PhotonNetwork.PhotonServerSettings.AppSettings.FixedRegion}");
PhotonNetwork.AddCallbackTarget(this);
PhotonNetwork.ConnectUsingSettings();

Comments

  • djohnsomsft, did you found the solution? i have the same error on UWP platform right now
  • Please set the logging levels to ALL and enable the SupportLogger.
    Run and post a log (maybe on pastebin or such)...

    If the solution works on other platforms (standalone, etc) but not on UWP, you may report a bug to Unity, too.
  • I'm facing this issue right now when running project on HoloLens (HL2) as well.

    Connection to the server works fine in the Unity Editor.

    HoloLens OS build:
    Windows Holographic for Business
    10.0.18362.1056
    Firmware 11968.01.01.191205.F

    Unity 2019.2.17f1
    Build Settings:
    UWP
    Target SDK: 10.0.18362.0
    Min SDK: 10.0.0.18362.0

    Here's a selected part of the log after setting logging levels to ALL and enabling . Note the ArgumentException error on SetSocketOptions.
    https://pastebin.com/ZnLCDU1R

    Some things I've tried:
    * Logging AppID and server before Connect is called to ensure they are loaded from Resources (they are)
    * Varying port numbers (maybe HoloLens has port restrictions my desktop does it)
    * Tried on multiple networks, same issue
    * Building with more recent Windows SDK (10.0.19041)
    * Setting min Windows SDK to 10.0.0.10240
    * Confirmed package manifest contains necessary permissions (InternetClient, InternetClientServer, PrivateNetworkClientServer), both in Unity and Visual Studio
    * Attempted solution from this post (disabling WSA from Metro/Photon3Unity3D.dll) https://forum.photonengine.com/discussion/12249/could-not-resolve-host-ns-exitgames-com-on-hololens

    My best guess at the moment given the error is that there is some mismatch between the way Photon is setting socket options, and the Windows socket APIs? Any help appreciated.
  • Did you find a solution,yet? Got the same issue :/
  • JohnTubeJohnTube mod
    edited May 19
    Hi @afauch,

    Thank you for choosing Photon and sorry for the delay.
    Note the ArgumentException error on SetSocketOptions.
    The pastebin is gone, any chance you could send us the logs again especially the stack trace of the exception?

    hey @feldn,

    Thank you for choosing Photon!

    Could you give us more details? platform, Unity version, PUN version, Scripting Backend, etc.
    Also use SupportLogger and share logs.
  • @JohnTube Thank you for your Help.

    • Platform: Hololens 2 (ARM64)
    • Target Windows SDK: 10.0.19041.0
    • Min Windows SDK: 10.0.10240.0
    • Unity version: 2019.3.14f1, 2019.4.13f1
    • PUN version: 2.18.1
    • Scripting Backend: IL2CPP / .NET 4.x
    • Capabilities: InternetClient, InternetClientServer, PrivateNetworkClientServer, WebCam, Microphone, SpacialPerception

    VSConfig:
    {
      "version": "1.0",
      "components": [
        "Microsoft.VisualStudio.Component.CoreEditor",
        "Microsoft.VisualStudio.Workload.CoreEditor",
        "Microsoft.NetCore.Component.Runtime.3.1",
        "Microsoft.NetCore.Component.SDK",
        "Microsoft.VisualStudio.Component.NuGet",
        "Microsoft.VisualStudio.Component.Roslyn.Compiler",
        "Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
        "Microsoft.Net.Component.4.8.SDK",
        "Microsoft.Component.MSBuild",
        "Microsoft.VisualStudio.Component.TextTemplating",
        "Microsoft.VisualStudio.Component.SQL.CLR",
        "Microsoft.Net.Component.4.5.TargetingPack",
        "Microsoft.VisualStudio.Component.IntelliCode",
        "Microsoft.VisualStudio.Component.DiagnosticTools",
        "Microsoft.VisualStudio.Component.AppInsights.Tools",
        "Component.Microsoft.VisualStudio.LiveShare",
        "Microsoft.VisualStudio.Component.VC.CoreIde",
        "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
        "Microsoft.VisualStudio.Component.Graphics.Tools",
        "Microsoft.VisualStudio.Component.VC.DiagnosticTools",
        "Microsoft.VisualStudio.Component.Windows10SDK.18362",
        "Microsoft.ComponentGroup.Blend",
        "Microsoft.VisualStudio.Component.Debugger.JustInTime",
        "Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging",
        "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
        "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
        "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
        "Microsoft.VisualStudio.Component.VC.CMake.Project",
        "Microsoft.VisualStudio.Component.VC.ATL",
        "Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest",
        "Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest",
        "Microsoft.VisualStudio.Component.VC.ASAN",
        "Microsoft.VisualStudio.Workload.NativeDesktop",
        "Microsoft.Component.NetFX.Native",
        "Microsoft.VisualStudio.ComponentGroup.UWP.NetCoreAndStandard",
        "Microsoft.VisualStudio.Component.Graphics",
        "Microsoft.VisualStudio.ComponentGroup.UWP.Xamarin",
        "Microsoft.VisualStudio.ComponentGroup.UWP.Support",
        "Microsoft.VisualStudio.Component.Windows10SDK.IpOverUsb",
        "Microsoft.VisualStudio.Component.VC.Tools.ARM64",
        "Microsoft.VisualStudio.Component.UWP.VC.ARM64",
        "Microsoft.VisualStudio.Component.VC.Tools.ARM",
        "Microsoft.VisualStudio.ComponentGroup.UWP.VC",
        "Microsoft.VisualStudio.Workload.Universal"
      ]
    }
    
    Log:
    errors.jpg
    Stacktrace:
    Autoconnected Player Failed to connect to server after testing each known IP. Error(s): System.ArgumentException: Value does not fall within the expected range.
      at System.Net.Sockets.Socket.SetSocketOption (System.Net.Sockets.SocketOptionLevel optionLevel, System.Net.Sockets.SocketOptionName optionName, System.Int32 optionValue) [0x00000] in <00000000000000000000000000000000>:0 
      at System.Net.Sockets.Socket.SocketDefaults () [0x00000] in <00000000000000000000000000000000>:0 
      at System.Net.Sockets.Socket..ctor (System.Net.Sockets.AddressFamily addressFamily, System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocolType) [0x00000] in <00000000000000000000000000000000>:0 
      at ExitGames.Client.Photon.SocketUdp.DnsAndConnect () [0x00000] in <00000000000000000000000000000000>:0 
      at UnityEngine.RemoteSettings+UpdatedEventHandler.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
      at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00000] in <00000000000000000000000000000000>:0 
      at UnityEngine.Video.VideoPlayer+EventHandler.Invoke (UnityEngine.Video.VideoPlayer source) [0x00000] in <00000000000000000000000000000000>:0 
      at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 
      at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x00000] in <00000000000000000000000000000000>:0 
      at System.Threading.ThreadHelper.ThreadStart () [0x00000] in <00000000000000000000000000000000>:0 
      at UnityEngine.RemoteSettings+UpdatedEventHandler.Invoke () [0x00000] in <00000000000000000000000000000000>:0 ;
    


    I do get the same error with this minimal Setup:
    using Photon.Pun;
    using Photon.Realtime;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class PhotonConnect : MonoBehaviourPunCallbacks
    {
        public void Awake()
        {
            PhotonNetwork.AutomaticallySyncScene = false;
        }
    
        void Start()
        {
            StartCoroutine(WaitToConnect());
    
            IEnumerator WaitToConnect()
            {
                yield return new WaitForSeconds(5f);
                PhotonNetwork.ConnectUsingSettings();
            }
        }
    
        public override void OnConnectedToMaster()
        {
            PhotonNetwork.JoinOrCreateRoom("TestRoom", new RoomOptions { MaxPlayers = 0 }, TypedLobby.Default);
        }
    
        public override void OnJoinedRoom()
        {
            Debug.Log("Room Joined");
        }
    }
    

    This Setup works in Editor, but not on the Hololens 2
  • Hi, I get a similar issue .. runs fine in editor, Can't get a connection in a build. I've created a link entry like so to stop stripping, to no avail.


    <assembly fullname="PhotonWebSocket">
    <type fullname="ExitGames.Client.Photon.SocketWebTcp" preserve="all"/>
    </assembly>
  • Hi @benjaminmbrown,

    Thank you for choosing Photon!

    Why do you need WebSocket for HoloLens? what protocol do you use?

    Hey everyone,

    We still can't figure out the issue and why it happens for some and not for others.
    So to narrow it down we need a pattern or common denominator between all cases where it does not work with the same error of this discussion.

    Is it the new versions used?
    Is it the arch? ARM64?
    Windows SDK versions?

    In the network/machine used, could yo try making sure only one IP protocol is used? IPv4 or IPv6 and not both? or maybe only IPv4!

    In any case, this is most likely a Unity bug!
    So it's highly recommended that you submit a bug report to Unity.
  • I get a same issue.. The program runs normally in Unity,and "total players in room:1" but when I use HoloLens2, it shows that:Failed to connect to server after testing each known IP. I just follow it https://docs.microsoft.com/zh-cn/windows/mixed-reality/mrlearning-sharing(photon)-ch2
    Any one can help me?
  • Hi @MysticY,

    Thank you for choosing Photon!

    We're still investigating this and trying to reproduce it.
    We are also trying to involve customers who don't have this issue on HoloLens / HoloLens 2 or managed to solve it without reporting it.

    In any case, provide more details, specially answers to questions previously asked in this discussion.
  • @johntube, I'm not using hololens.. just developing a desktop windows game .. 64 bit build. Works fine in editor but after a build it will not be able to connect via standalone or from our Steam beta depot. Will get more details in a few.
  • I somehow got it working, but i still don't know what the issue was.
    After building my project on another pc it worked.

    Therefore I deleted Visual Studio and Unity and deleted all components (windows sdks, c++ runtime, etc.) by hand.

    Then i reinstalled Visual Studio 2019, Visual Studio 2019 Build tools and Unity 2019.3.14f with the following configurations from the other PC:

    Visual Studio:
    {
      "version": "1.0",
      "components": [
        "Microsoft.VisualStudio.Component.CoreEditor",
        "Microsoft.VisualStudio.Workload.CoreEditor",
        "Microsoft.NetCore.Component.Runtime.3.1",
        "Microsoft.NetCore.Component.SDK",
        "Microsoft.VisualStudio.Component.NuGet",
        "Microsoft.Net.Component.4.6.1.TargetingPack",
        "Microsoft.VisualStudio.Component.Roslyn.Compiler",
        "Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
        "Microsoft.VisualStudio.Component.FSharp",
        "Microsoft.NetCore.Component.DevelopmentTools",
        "Microsoft.Net.Component.4.8.SDK",
        "Microsoft.Net.Component.4.7.2.TargetingPack",
        "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
        "Microsoft.Component.MSBuild",
        "Microsoft.VisualStudio.Component.TextTemplating",
        "Microsoft.VisualStudio.Component.SQL.CLR",
        "Microsoft.VisualStudio.Component.ManagedDesktop.Core",
        "Microsoft.Net.Component.4.5.2.TargetingPack",
        "Microsoft.Net.Component.4.5.TargetingPack",
        "Microsoft.VisualStudio.Component.IntelliCode",
        "Microsoft.Net.Component.4.TargetingPack",
        "Microsoft.Net.Component.4.5.1.TargetingPack",
        "Microsoft.Net.Component.4.6.TargetingPack",
        "Microsoft.Net.ComponentGroup.TargetingPacks.Common",
        "Microsoft.Net.Core.Component.SDK.2.1",
        "Microsoft.VisualStudio.Component.DiagnosticTools",
        "Microsoft.VisualStudio.Component.EntityFramework",
        "Microsoft.VisualStudio.Component.AppInsights.Tools",
        "Component.Microsoft.VisualStudio.LiveShare",
        "Microsoft.VisualStudio.Component.VC.CoreIde",
        "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
        "Microsoft.VisualStudio.Component.Graphics.Tools",
        "Microsoft.VisualStudio.Component.VC.DiagnosticTools",
        "Microsoft.VisualStudio.Component.Windows10SDK.18362",
        "Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
        "Microsoft.ComponentGroup.Blend",
        "Microsoft.VisualStudio.Component.Debugger.JustInTime",
        "Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging",
        "Microsoft.VisualStudio.Workload.ManagedDesktop",
        "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
        "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
        "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
        "Microsoft.VisualStudio.Component.VC.CMake.Project",
        "Microsoft.VisualStudio.Component.VC.ATL",
        "Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest",
        "Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest",
        "Microsoft.VisualStudio.Component.VC.ASAN",
        "Microsoft.VisualStudio.Workload.NativeDesktop",
        "Microsoft.Component.NetFX.Native",
        "Microsoft.VisualStudio.ComponentGroup.UWP.NetCoreAndStandard",
        "Microsoft.VisualStudio.Component.Graphics",
        "Microsoft.VisualStudio.ComponentGroup.UWP.Xamarin",
        "Microsoft.VisualStudio.ComponentGroup.UWP.Support",
        "Microsoft.VisualStudio.Component.VC.Tools.ARM64",
        "Microsoft.VisualStudio.Component.UWP.VC.ARM64",
        "Microsoft.VisualStudio.Component.VC.Tools.ARM",
        "Microsoft.VisualStudio.ComponentGroup.UWP.VC",
        "Microsoft.VisualStudio.Workload.Universal"
      ]
    }
    

    Build Tools:
    {
      "version": "1.0",
      "components": [
        "Microsoft.VisualStudio.Component.Roslyn.Compiler",
        "Microsoft.Component.MSBuild",
        "Microsoft.VisualStudio.Component.CoreBuildTools",
        "Microsoft.VisualStudio.Workload.MSBuildTools",
        "Microsoft.VisualStudio.Component.Windows10SDK",
        "Microsoft.VisualStudio.Component.VC.CoreBuildTools",
        "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
        "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
        "Microsoft.VisualStudio.Component.Windows10SDK.18362",
        "Microsoft.VisualStudio.Component.VC.CMake.Project",
        "Microsoft.VisualStudio.Component.TestTools.BuildTools",
        "Microsoft.Net.Component.4.8.SDK",
        "Microsoft.Net.Component.4.6.1.TargetingPack",
        "Microsoft.VisualStudio.Component.VC.ASAN",
        "Microsoft.VisualStudio.Component.VC.v141.x86.x64",
        "Microsoft.VisualStudio.Workload.VCTools",
        "Microsoft.VisualStudio.Component.NuGet.BuildTools",
        "Microsoft.Net.Component.4.TargetingPack",
        "Microsoft.Net.Component.4.5.TargetingPack",
        "Microsoft.Net.Component.4.5.1.TargetingPack",
        "Microsoft.Net.Component.4.5.2.TargetingPack",
        "Microsoft.Net.Component.4.6.TargetingPack",
        "Microsoft.Net.ComponentGroup.TargetingPacks.Common",
        "Microsoft.NetCore.Component.Runtime.3.1",
        "Microsoft.NetCore.Component.SDK",
        "Microsoft.Net.Core.Component.SDK.2.1",
        "Microsoft.Component.ClickOnce.MSBuild",
        "Microsoft.VisualStudio.Wcf.BuildTools.ComponentGroup",
        "Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools",
        "Microsoft.Component.NetFX.Native",
        "Microsoft.VisualStudio.ComponentGroup.UWP.BuildTools",
        "Microsoft.VisualStudio.Component.VC.Tools.ARM64",
        "Microsoft.VisualStudio.Component.UWP.VC.ARM64",
        "Microsoft.VisualStudio.Component.VC.Tools.ARM",
        "Microsoft.Net.Component.4.7.2.SDK",
        "Microsoft.VisualStudio.ComponentGroup.UWP.VC.BuildTools",
        "Microsoft.VisualStudio.Component.VC.v141.ARM",
        "Microsoft.VisualStudio.Component.VC.v141.ARM64",
        "Microsoft.VisualStudio.ComponentGroup.UWP.VC.v141.BuildTools",
        "Microsoft.VisualStudio.Workload.UniversalBuildTools"
      ]
    }
    

    Then i built it with:
    • Target Device: Hololens
    • Architecture: ARM64
    • Target SDK Version: 10.0.18362.0
    • Minimum Platform Version: 10.0.16299.0
  • Hey @feldn,

    Good news!
    Any idea what the cause might have been?
    Target SDK Version? Minimum Platform Version?
    or maybe we should do a diff of VSConfig or Built Tools?
  • I don't really think that its the target or minimum sdk version, as i tested these ones before. I think Unity or Visual Studio is using some framework or sdk it shouldn't use based on the ones installed on the system. So I guess a diff would be the right approach.

    Please note: Uninstalling Visual Studio does not uninstall all the sdks, frameworks, etc. You have to do it on your own.
  • Update:
    This is probably a Unity issue, see bug report here.
  • I'm having this similar issue while building a Hololens 2 app with Photon PUN 2 functionalities. After some time I found out that the issue lies with using Windows SDK Version 10.0.19041.0 as target sdk version, which causes Photon PUN 2 functionalities to fail.

    Here's what to do specifically:
    - Uninstall Windows SDK Version 10.0.19041.0 and install previous version of Windows SDK (i.e. 10.0.18362.0).
    - In Unity Build Settings and Visual Studio project properties, make sure that the target SDK version is set to the correct version.

    While building in Unity, you might have to build an entirely new Visual Studio build directory, otherwise it will still fail while building into Hololens 2 using Visual Studio, returning error mentioning cannot locate SDK Version 10.0.19041.0.
  • Hi @DarksiderRay,

    Thank you for choosing Photon and for your input!

    Yes that's what the issue here (posted above) is about, Windows SDK 10.0.19041.0.
  • Hi @DarksiderRay ,

    Thanks for your help. I was able to solve part of the problem using the method you suggested.
    Earlier stand-alone UWP app did not start listening now it starts listening but does not accept connections and does not receive files. I am not getting any errors from stand-alone app but the app I am using to send files throws attempt failed because the connected party did not properly respond error.
    System.Net.Sockets.SocketException: 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 127.0.0.1:1300'

    Please help me I have been trying to solve this problem for few days now.
    Note: Everything works fine on Unity Editor I am able to recieve files, problem is only with Stand Alone app.
    Using same system to run server and client hence there should be no firellwall or router issues. Still I have disabled firewall.

    Target Device: PC
    Architecture: X64
    Target SDK Version: 10.0.18362.0
    Minimum Platform Version: 10.0.10240.0
  • Hi @SweetCrackers,

    Thank you for choosing Photon!

    Not sure if you are asking about something Photon related as this does not look like it.
    127.0.0.1:1300 is not a Photon Cloud address unless you are connecting to a self-hosted Photon Server and you changed default port.
  • Hi @JohnTube
    You are right it is not related to Photon, 127.0.0.1:1300 is local IP I am trying to send files to.
    I decided to comment here as this is the only place I found some solution to the problem I am facing.
  • To solve that problem for now, Uninstall all windows sdk, except Windows sdk 10.0.18362.0 on your dev machine. So you should have only one Windows sdk 10.0.18362.0 there;

    What i did is i just deleted VS with all windows sdk from VS installer, and install VS 2019 again with only SDK 18362 being selected;
  • Hi,

    I'm having the exact same issue but even after following all your advices, i can't figure out what's wrong. I even tried with a brand new project but still get the same error on the Cloud or on a Local server with TPC or UDP.

    The error is the following : "Failed to connect to server after testing each known IP. Error(s):"

    I'm build a Unity app on HoloLens 1 with the following settings on Unity :

    Target Device: HoloLens
    Architecture: X86
    Target SDK Version: 10.0.18362.0
    Minimum Platform Version: 10.0.10240.0
    Visual Studio Version : 2019
    Build configuration : Release

    On VS 2019, i build the app under an "app" folder as recommended with Release and x86 architecture.

    I uninstalled VS 2017 and all the SDK associated and reinstalled VS 2019 with only the SDK version 10.0.18362.0 but still get the same issues.

    I also made sure that InternetClient, InternetClientServer and PrivateNetworkClientServer were check under PlayerSettings>Publishing settings.

    Do you guys have any recommendations ?
  • Hi @maxut,

    Thank you for choosing Photon!

    Did you try using another Unity version?
    This issue is probably related to this so avoid the Unity versions reported there.
Sign In or Register to comment.