Connecting to two rooms at the same time

ikrommikromm
edited October 10 in Photon Voice
Hi there!

I have been using Photon for quite some time now for "common" stuff, but now things are getting a bit dirtier.
So, forum to the resque :)

I have been trying to connect to two separate rooms on the same server from the same client and I'm receiving the following error when trying to create the second room.

Failed parsing address:
UnityEngine.Debug:LogError(Object)
Photon.Realtime.LoadBalancingClient:DebugReturn(DebugLevel, String) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2081)
ExitGames.Client.Photon.IPhotonSocket:Connect() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/IPhotonSocket.cs:105)
ExitGames.Client.Photon.SocketUdp:Connect() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/SocketUdp.cs:63)
ExitGames.Client.Photon.EnetPeer:Connect(String, String, Object) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:269)
ExitGames.Client.Photon.PhotonPeer:Connect(String, String, Object) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1263)
Photon.Realtime.LoadBalancingClient:ConnectToGameServer() (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:878)
Photon.Realtime.LoadBalancingClient:OnStatusChanged(StatusCode) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2566)
ExitGames.Client.Photon.<>c__DisplayClass105_0:b__0() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:907)
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:431)
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1596)
Photon.Voice.Unity.VoiceConnection:Dispatch() (at Assets/Photon/PhotonVoice/Code/VoiceConnection.cs:363)
Photon.Voice.Unity.VoiceConnection:FixedUpdate() (at Assets/Photon/PhotonVoice/Code/VoiceConnection.cs:346)


Backstory:
What I'm trying to do exactly is to have two simultaneous connections from the same client to two different rooms on the same Loadbalancing (self hosted) server instance. One connection would be to allow Unity stuff to work (like RPCs or PhotonView synchronizations) and the other one would be for the Voice Chat.

For the first connection I'm using PUN, since it seems to be a nice wrapper for the LoadBalancingClient which as far as I see, does not leak settings, connections or other stuff to the Voice Clients. Long story short, after customizing the settings, versions and the rest, I connect to the server (not via ConnectUsingSettings), create a room and join it. Everything works fine. I can send RPCs and sync PhotonViews normally.

The problem arises when I try to create a new room for the voice chat.
Upon joining the room, the VoiceConnection class takes charge and tries to connect to the same server using the ConnectUsingSettings method, but I override the settings myself with the following
new AppSettings()
            {
                Port = 0,
                Protocol = ConnectionProtocol.Udp,
                Server = PhotonNetwork.ServerAddress,
                NetworkLogging = DebugLevel.ALL,
                AppVersion = PhotonNetwork.NetworkingClient.AppVersion,
                AppIdRealtime = PhotonNetwork.NetworkingClient.AppId,
                AppIdVoice = PhotonNetwork.NetworkingClient.AppId,
                UseNameServer = false
            });
The client tries to connect, connects to the master server and the I try to create the new room and join it.
[Network.VoiceManager] OnVoiceStateChanged from ConnectedToMaster to Joining

Immediately, the state changes to DisconnectingFromMasterServer
[Network.VoiceManager] OnVoiceStateChanged from Joining to DisconnectingFromMasterServer SocketUdp.Disconnect() Connect() SocketUdp: UDP, Unity3d.

And then the error appears:
Failed parsing address:
Along with (yet again)
SocketUdp.Disconnect()

The first connection remains intact, but the Voice Connection did not succeed.

The server is running an unmodified version of the LoadBalancing App.

Any insight on why that might happen would be greatly appreaciated.
If you need any more info, or to provide more code on a specific part of the process, please ask.

Thanks a lot in advance,
John.

Comments

  • Hi @ikromm,

    Thank you for choosing Photon!

    I think you may be reinventing the wheel as Photon Voice does actually what you are trying to do.
    The PUN Integration is exactly what you described.
    Besides, there is no need to override the AppSettings for the VoiceConnection since it looks like you use PUN Settings.

    Could you try DemoVoicePun from Photon Voice 2? You could just configure PhotonServerSettings to connect to your self-hosted Photon Server.

    Otherwise, the issue looks like maybe only Voice client is trying to connect to the self-hosted Photon Server and you have a wrong configuration of the Game Server IP address.
  • I see.
    I probably took the wrong way trying to do stuff from the ground up. I'll check it out and I'll let you know my findings.

    Thanks a lot for the reply.
  • Yup. Everything worked out.

    Thanks for the heads up.
Sign In or Register to comment.