Quantcast
Channel: Photon Server — Photon Engine
Viewing all articles
Browse latest Browse all 1557

I can't connect to my Photon server (self hosted).

$
0
0
Hello,

After a little hour of searching for a similar post (please excuse me in advance if I didn't find one and you redirect me to a similar post...), I can't find a solution to my problem.

I'm trying to connect a client to the Photon self hosted server.
I use PhotonControl, I started "LoadBalancing / Start as Application". I haven't touched the configurations yet.

I need your help. In the console of Unity, i've the log "Try to connect to : 127.0.0.1:5055".
But no callbacks are called.

PS: The Connect function is called by another class.

THANK YOU in advance :smiley:

I'm developing a client on Unity (in C#), here is the code of my client:

class MyClient : IConnectionCallbacks
{
private LoadBalancingClient loadBalancingClient;

public MyClient()
{
this.loadBalancingClient = new LoadBalancingClient();
this.SubscribeToCallbacks();
}

~MyClient()
{
this.UnsubscribeFromCallbacks();
}

private void SubscribeToCallbacks()
{
this.loadBalancingClient.AddCallbackTarget(this);
}

private void UnsubscribeFromCallbacks()
{
this.loadBalancingClient.RemoveCallbackTarget(this);
}

public void Connect(string address, int port)
{
this.loadBalancingClient.MasterServerAddress = string.Format("{0}:{1}", address, port);
Debug.Log("Try to connect to : " + this.loadBalancingClient.MasterServerAddress);
this.loadBalancingClient.ConnectToMasterServer();
}

void IConnectionCallbacks.OnConnected()
{
Debug.Log("Connected");
// client is now connected to Photon Master Server and ready to create or join rooms
}

void IConnectionCallbacks.OnConnectedToMaster()
{
Debug.Log("Connected To Master");
// client is now connected to Photon Master Server and ready to create or join rooms
}

void IConnectionCallbacks.OnDisconnected(DisconnectCause cause)
{
Debug.Log("Disconnected: " + cause.ToString());
// client is now discconnected from Photon Master Server
}

void IConnectionCallbacks.OnRegionListReceived(RegionHandler handler)
{
Debug.Log("Region List : ");
// client is now discconnected from Photon Master Server
}

void IConnectionCallbacks.OnCustomAuthenticationResponse(Dictionary<string, object> response)
{
}

void IConnectionCallbacks.OnCustomAuthenticationFailed(string fail)
{
}
}


Viewing all articles
Browse latest Browse all 1557

Trending Articles