Simple script can't get past "connecting to nameserver"

PolerinPolerin
edited October 23 in DotNet
So I ran the particle demo, it seems to be connecting just fine. Same machine, same OS, I try to connect in my own project and it's not getting past Connecting to Nameserver. Don't think it's a unity blocked by firewall thing, given the demo code is running, and I turned off the windows firewall anyhow. An oddity is that in my actual game code when the Peer status changes to connected (to the name server), it is not showing any packets in or out, even after a delay and recheck. Just .. yeah. frustrate.

Created a minimal reproduction of what I've got going on, curious if anyone can tell me what I'm doing wrong?

Unity 2019.1.11f1
Windows 10 pro
Whatever photon version is in the current PhotonRealtime particle demo's Assets folder

"connect script" used to trigger the connection

using UnityEngine;
using Photon.Realtime;

public class connectScript : MonoBehaviour
{
  TestClient client;
  public void Start()
  {
    this.client = new TestClient("****snipped****", "1.0");
  }

  public void ClickHandler()
  {
    Debug.Log("Calling connect");
    this.client.CallConnect();
  }
}



Test client class

using global::Photon.Realtime;
using ExitGames.Client.Photon;

using UnityEngine;

public class TestClient : LoadBalancingClient
{

  public TestClient(string appId, string gameVersion)
  {
    this.LoadBalancingPeer.DebugOut = DebugLevel.ALL;
    this.AppId = appId;
    this.AppVersion = gameVersion;

    this.LocalPlayer.NickName = "usr" + SupportClass.ThreadSafeRandom.Next() % 99;
  }

  public void CallConnect()
  {
    // trimmed to not even try the master server, I've tried with US, USW, us, usw as well
    bool couldConnect = this.ConnectToRegionMaster("EU");

    if (!couldConnect)
    {
      // This is not triggered
      this.DebugReturn(DebugLevel.ERROR, "Can't connect to: " + this.CurrentServerAddress);
    }
  }

  private void OnStateChanged(ClientState fromState, ClientState toState)
  {
    // This is triggered once, from "PeerCreated" to "ConnectingToNameserver"
    Debug.LogWarning("from: " + fromState + " To: " + toState);
  }

  public override void OnStatusChanged(StatusCode statusCode)
  {
    // Never triggered
    Debug.LogWarning("StatusChange to: " + statusCode);
    base.OnStatusChanged(statusCode);
  }

  public override void OnOperationResponse(OperationResponse operationResponse)
  {
    // Never triggered
    Debug.Log("Op response");
    Debug.LogWarning(operationResponse);

    base.OnOperationResponse(operationResponse);
  }
}



Really sorta frustrated, I'm close to 10 hours on this, inspecting it every way I can figure, not seeing anything that can give me more info.

Thanks in advance.

Comments

  • ack, it's inline, trying to fix
  • Hi @Polerin,

    Thank you for choosing Photon!

    Did you call Service() periodically in your game loop?
    It's documented here.
  • JohnTube said:

    Hi @Polerin,

    Thank you for choosing Photon!

    Did you call Service() periodically in your game loop?
    It's documented here.

    Service() is needed to progress past the connection? Ah crud.. That's not clear in the documentation. I was going to start calling service once I had connection confirmation.
  • @JohnTube that was it. Might suggest that you add a specific call out to that fact in the documentation about connect()? I was trying to build up my adapter one bit of functionality at a time, and so I hadn't implemented the polling yet. Regardless, thanks for the help!
Sign In or Register to comment.