Photon server and IPv6

Options
no1no
no1no
edited June 2016 in Photon Server
My update build was rejected by Apple today because the reviewer can't connect to the server and it seems it's because my game / server does not support IPv6. I read the forum and it seems the newer version of Photon server / PUN+ support IPv6. My question is do I have to update the server or do I have to update the client (I'm using PUN+ v.1.51 and the LoadBalancing server as base). If possible I want to update the least number of file the possible because I heavily modified some of the Photon code (like the networkingpeer.cs in PUN+ for example).

A question unrelated to Photon: how can setup an IPv6 environment so I can test it like the guy at Apple does?
«1

Comments

  • no1no
    Options
    Sorry I'm not good with networking so the link is still a bit confusing to me.

    The link doesn't mention the version of PUN that support IPv6 but I have checked the file Photon3Unity3D.dll in Photon folder and its version is 4.0.0.9, is it good enough?

    Since my server don't use IPv6 I have to choose option A and use "Bridged IPv6 to IPv4". Is it correct?

    I still have no idea how to test it though.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @no1no,

    We will update the IPv6 documentation with more details soon. Thanks for pointing out that the PUN version supporting IPv6 is not mentioned.
    Since my server don't use IPv6 I have to choose option A and use "Bridged IPv6 to IPv4". Is it correct?
    Yes that should be it.
    I still have no idea how to test it though.
    You can find your answer in Apple's official documentation here.
  • no1no
    Options
    Thanks @JohnTube for your link to Apple doc, I was able to setup the environment to test IPv6. Could you tell me more about "Bridged IPv6 to IPv4" and setting up Photon server to use FQDN or give me a link to a guide to set it up on the server? I tried to search about it but every thing seems vague to me.
  • no1no
    Options
    After checking the domain I'm using I notice that it actually support bridged IPv6 to IPv4 (I ping the domain from IPv6 network and got IPv6 IP, if I ping from IPv4 network I got IPv4 IP). So I guess my problem is not the domain but either the server or the Photon API. I just want to make sure Does my PUN version (1.51 with Photon3Unity3D.dll version 4.0.0.9) support IPv6? and if it doesn't then from which version does it support? where can I download the old version? I don't really want to download the newest version because I modified the photon files heavily (like the file networkingPeer.cs).

    Also how can I setup Photon Server to use domain instead of IP because whenever client create a room or join a room the server always returns the IP of the game server instead of domain name.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited June 2016
    Options
    Hi @no1no,

    PUN IPv6 support started with v1.68. Latest version today is v1.70. So I think you can't avoid this.

    Please upgrade to that version and then let us know if you still encounter issues.
  • no1no
    Options
    Thanks, guess I don't have a choice here. What about setting Photon server so it returns domain name instead of IP?
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited June 2016
    Options
    It should work out-of-box when you update your client.

    For S2S communication you may need extra configuration.
    Set PublicHostName to the domain name of your Photon Server in the configuration file of your Photon applications ("app.config" before compilation, "{DLL_name}.config" after compilation) as follows:
    <setting name="PublicHostName" serializeAs="String">
    	<value>YOURhost.YOURdomain.com</value>
    </setting>
    Example:
    For Photon LoadBalancing application, this should be done for game server in "GameServer\bin\Photon.LoadBalancing.dll.config" file.
  • Tobias
    Options
    The older clients don't support using IPv6 addresses when the hostnames get resolved. Sorry, you need to update PUN for this to work.

    The changelog might give you hints what changed and how. In doubt, you can also ask in the forum (new thread).
    Don't be scared when you get a lot of errors after importing a new PUN version. The principles are the same as before and often it's just a matter of adjusting to some new API.
  • no1no
    Options
    Thanks John and Tobias, I have updated PUN and merge my changes with new PUN thank to the comparing tool. However I'm unable to connect to the server, it seems my server refuse connection from the new PUN (I got "OnStatusChanged: DisconnectByServer" as soon as I connect). Do I have to update Photon Server SDK too? I wrote my server base on LoadBalancing example and I added a lot of new things so I don't really want to update it.
  • jelybrd
    Options
    I've been having this same issue. I noticed it today though, everything was working fine yesterday, I opened my project today, and boom it was broken. I have updated since then hoping it would fix the issue but it did not.

    I get stuck on ConnectedToMaster and I've noticed a new debug statement about the IPv6 which was not there yesterday. This is unfortunate because I was getting close to the clean-up stages before I pushed to the App Store.
  • chvetsov
    Options
    @no1no and @jelybrd please collect logs from server side. also provide configs for Photon Server (aka PhotonServer.config) and for your LoadBalancing projects (aka assembly_name.dll.config) i mean for Master and GameServer
  • no1no
    no1no
    edited June 2016
    Options
    I monitored the MSMaster, GSGame and PhotonCLR log and nothing happened when I clicked connect but I got this from Photon-LoadBalancing-20160615.log
    7604: 15:36:02.757 - 04318360: id = 0 [0] disconnected due to exception
    7604: 15:36:02.757 - CENetThreadPool::Process - Exception - CENetPeerBase::HandleIncomingCommands() - PeerAppSelection()- Init: Unexpected client lib delimiter, expected: 0x01, got: 0x1e : id = 0 [0] Datagram: 00 00 CC 02 00 00 00 7D 25 39 57 0F 0C B8 82 C9 01 FF 00 04 00 00 00 14 00 00 00 00 00 00 00 00 00 71 64 DE 06 00 01 04 00 00 00 35 00 00 00 01 F3 00 01 06 1E 41 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  - .......}%9W......................qd........5.........A................................... from: 127.0.0.1:62072 on: 127.0.0.1:5055
    
    I'm not sure how to attach a file and the editor don't accept xml so I pasted it to pastebin: http://pastebin.com/w97GkXsY (it is pratically the file PhotonServer.LoadBalancing-Development.config, I don't think I changed anything in it).
  • Tobias
    Options
    @no1no: There are a few new values in the protocol to support IPv6, so the server needs to be updated.

    Our IPv6 page (which chvetsov pointed to, earlier) lists this is the minimum server version to support IPv6: "Photon Server SDK / Photon Plugins SDK: starting from version 4.0.28.x".
    I'm sorry but maybe you have to update.
  • Tobias
    Options
    @jelybrd: Are you also using a custom server? If you use the Photon Cloud, please create a new thread and include as much relevant info as you can (client logs, unity and pun versions, etc).
    If you're testing with Apple's "Shared IPv6-only WiFi", you maybe don't run that?
  • no1no
    Options
    This is a big problem for me. I've just downloaded the new Photon Server SDK and it seems the amount of things change is huge and the biggest problem to me is the users with the old client might not be able to connect to the server just like the new version can't connect to the old server. If they can't connect to the server I can't inform them that their client are outdated (I include the client version in the authenticate parameters) and redirect them to the store.

    I will try to upgrade the server and see if the old version can still connect and if it can't connect I may need a solution for this.
  • Tobias
    Options
    The new server should be mostly compatible with the old clients. We try not to break things.
    Please get in touch when you run into issues that are due to updating.

    Important info: I need to verify this but as far as I know there is a way to support clients which are in IPv6 networks behind DNS64/NAT64. For this, the server only needs to send host names instead of IPs and I just remember that there is a way to do this in one of the latest 3.x server versions.

    If you don't need proper IPv6 addresses for your Photon server, this could be an option!

    I am quite sure we don't have this documented yet. Let me know and we will send you the info asap.
  • no1no
    Options
    Thanks, it's a relief to know that old client can still connect to new server though I still need to test that.

    As for IPv6 client connect to IPv4 server problem JohnTube already told me about the domain name solution in a post above if there is more to it (or a proper document) then it's even better.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited June 2016
    Options
    The method mentioned by Tobias in his last post is for Photon Server version 3 involves a slight change in source code of LoadBalancing application:

    Set RegisterGameServer.GameServerAddress to your domain name in OutgoingMasterServerPeer.Register (line 251 in "OutgoingMasterServerPeer.cs") as follows:
    protected virtual void Register()
    {
          var contract = new RegisterGameServer
         {
                  GameServerAddress = "yourhost.yourdomain.com",//GameApplication.Instance.PublicIpAddress.ToString(),
    You need latest Photon Server version.

    The method I shared in my previous post and which is now available in our updated Photon Server IPv6 doc page is for Photon Server version 4.
  • no1no
    Options
    But in both case I have to update Photon Server to the latest version, right? Also the solution above only work if I can connect to Master server from IPv6 network first but I couldn't. So my only choice here is still updating both the server and client to latest version.
  • jelybrd
    Options
    I'm not sure if this is the case for you, but I accidentally unchecked the box in my PhotonServerSettings called Auto-Join Lobby which got me stuck at the OnJoinedMaster stage of connecting.
  • no1no
    no1no
    edited June 2016
    Options
    @chvetsov: Thanks. So if I use this SDK I don't have to update my client and only have to upgrade my server to 3.4.31 so a client from an IPv6 network can connect to my server?

    I'm in process of upgrading my server code to the latest 4.x version and after clearing all the build error and run I got exception when I run through this line in MasterServerConnectionBase:
    if (this.peer.ConnectTcp(endPoint, "Master"))

    The exception:
    Photon.LoadBalancing.GameServer.MasterServerConnectionBase - System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'PhotonHostRuntimeInterfaces.IPhotonPeer'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{92B33766-78D6-4ABA-9523-BA671A9C2788}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
    I think this is more likely a problem with Visual Studio than Photon but after googling around I'm unable to find the answer I decide to ask here in case anyone have seen this before.
  • no1no
    no1no
    edited June 2016
    Options
    Ignore the above exception I don't get it anymore but now I got a new exception whenever I use EntityFramework
    An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
    I tried to created a completely new project, adding EF via NuGet create new edmx but the problem still happened. This bug probably has nothing to do with Photon but I still want to ask because I have a feeling photon plugin manager and how it load assemblies might cause problem. Is there something I need to know about it?

    Edit: there is definitely something wrong with the LoadBalancing example. I opened a fresh LoadBalancing project, added EF, create a edmx with one table model and initialize the context in MasterApplication and I still got this error.
  • chvetsov
    Options
    Please explain what are you tring to get. also does test plugins work for you? could you try to add referenence to EntityFramwork to TestPlugins and try same
  • no1no
    Options
    I didn't tried to get anything, I simply initialized the context. The error is on this line:
    MyDbEntities db = new MyDbEntities();
    and adding EF to TestPlugin doesn't work, I still got the error.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @no1no,

    I think it would be better to create a new discussion about Photon Server v3 update issues with all the details you can provide.
  • Tobias
    Options
    @no1no: Please keep your questions on topic (IPv6) or use a new thread. Using this as your support thread is more than confusing. Thanks.
  • no1no
    no1no
    edited June 2016
    Options
    So I have upgraded both the client (PUN+) and the server to the latest version and I only use domain name to connect. And then I setup an local IPv6 network to test (I followed the instruction in this article) I built the app, connect to the test wifi and ran it and I got this error
    Connect() to '<<my server domain name>>' () failed: System.Net.Sockets.SocketException: No such host is known
      at System.Net.Dns.hostent_to_IPHostEntry (System.String h_name, System.String[] h_aliases, System.String[] h_addrlist) [0x00000] in <filename unknown>:0 
      at System.Net.Dns.GetHostByName (System.String hostName) [0x00000] in <filename unknown>:0 
      at System.Net.Dns.GetHostEntry (System.String hostNameOrAddress) [0x00000] in <filename unknown>:0 
      at ExitGames.Client.Photon.IPhotonSocket.GetIpAddress (System.String serverIp) [0x00000] in <filename unknown>:0 
      at ExitGames.Client.Photon.SocketUdp.DnsAndConnect () [0x00000] in <filename unknown>:0
    Was I missing something with my setup?