The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Connected but failed to create room

JPGOrdon
2020-09-21 10:19:20

After successfully connected to my server, I call the joinRandomRoom function on the on connected to master and on lobby connected functions each. When the random fails, I simply create a room. However, the room is unable to be created and I confirmed this with a OnCreateRoomFailed event. Why is it failing to create a room?

The callbacks are being called correctly, which makes me think the server configuration is correct. The master is called first, the issue is with the method "CreateRoom".

I have attached my code and debug log.
Any help would be much appreciated.

unity output:

Comments

JPGOrdon
2020-09-21 10:21:25

Keep in mind I have IPv6 clients with an Ipv6 server, if that makes any difference. I even followed the tutorial from https://doc.photonengine.com/zh-tw/pun/v2/demos-and-tutorials/pun-basics-tutorial/lobby and am coming up with the same room creation error.

JohnTube
2020-09-21 10:48:40

Hi @JPGOrdon,

Thank you for choosing Photon!

So you are using a self-hosted Photon Server.

Change port to 5055.

Which Photon Server SDK version do you use?

Port number 5056 is by default for the Game Server, not the Master Server (5055).
Are you sure you have the correct configuration?

Not sure what you did but from the two error messages for JoinRandomRoom ("Unknown operation code") and CreateRoom ("Missing value 255 (JoinGameRequest.GameId)"), it looks like you connected to Game Server and not Master Server.

Not sure how this could happen, I thought a client cannot connect directly to a Game Server without authenticating on Master Server or Name Server first.

Side notes:
I recommend you edit your post and hide your server address for security reasons.
You can use PUN 2's ConnectUsingSettings to connect to your on-premises server by setting the appropriate PhotonServerSettings.

JPGOrdon
2020-09-21 11:44:23

I am connecting to the master correctly because its callback is invoked, as suggested in the logs. I am connecting to my master server using a DNS and don't specify a port. The callbacks are being called in the correct order it seems. Should I specify a port when connecting to my master for this reason? Is this simply the reason why the room is failing, even though the master callback is being invoked?

I assume the error code for "JoinRandomRoom" would be because there were no open rooms in my instance. The second error code perplexes me.

As a side note, in my current setup, the game servers and main servers are hosted on the same VM. I did get this same setup working on my laptop (instead of my iOS device), so I am guessing this to be an issue with my client code. I am using the latest SDk for server v4 and .NET 3.5, which my Windows Server was forcing me to use.

JPGOrdon
2020-09-21 20:22:00

These errors occured because of the port I was connecting to upon "ConnectToMaster" invokation. When you connect to a master, it will always be port 5055 like @JohnTube suggested. Hope this helps others.

Back to top