InvalidOperationException

The whole answer can be found below.

Please note: 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! And we offer you support through these channels:

Try Our
Documentation

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

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.

InvalidOperationException: Failed to bind socket to [Address Ip=127.0.0.1 Port=9999]

AlCaTrAzz
2022-04-30 07:57:19

I'm getting

InvalidOperationException: Failed to bind socket to [Address Ip=127.0.0.1 Port=9999]

on a standalone client when trying to connect to a dedicated/headless server, I'll put the code snippets I'm using for server/client below, but would love any advice on what I might be doing wrong here...

var result = await runner.StartGame(new StartGameArgs { Address = NetAddress.LocalhostIPv4(port: 9999), GameMode = GameMode.Server, Scene = sceneIndex, SceneObjectProvider = NetworkSceneManager.Instance });

_runner.StartGame(new StartGameArgs { Address = NetAddress.LocalhostIPv4(port: 9999), GameMode = GameMode.Client, SceneObjectProvider = NetworkSceneManager.Instance });

Comments

ramonmelo
2022-06-15 15:04:15

Hi @AlCaTrAzz ,

The "Address" argument (https://doc-api.photonengine.com/en/fusion/current/struct_fusion_1_1_start_game_args.html#ab24301f95b9049bdf9d21b31b95693c4) is the local EndPoint where the peer will Bind (https://www.ibm.com/docs/en/zos/2.3.0?topic=functions-bind-bind-name-socket).

In your case, you are trying to bind two peers at the exact same port, which is not possible.

Usually, you don't need to worry about IP/Ports, as all the connection is handled by Fusion itself.

Or, if you still need to bind the peers, just choose different ports. If you don't set one, Fusion will pick a random available port.

--

Ramon Melo

Photon Fusion Team

Back to top