IPv6 support

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

jack90
Posts: 4
Joined: 25 Jul 2016, 14:01

Re: IPv6 support

Postby jack90 » 25 Jul 2016, 14:46

Yeah,
I just check log...
- But I use C++ API 1.6.4, client cannot login to server.


I saw client can connect to server, but cannot login.

Where my problem in my client or my server?
User avatar
Bax
Site Admin
Posts: 4393
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: IPv6 support

Postby Bax » 25 Jul 2016, 16:41

It is very difficult to say, without an error to inspect. What do you get on the client side when you send the login request?
Paolo Bax
The SmartFoxServer Team
jack90
Posts: 4
Joined: 25 Jul 2016, 14:01

Re: IPv6 support

Postby jack90 » 26 Jul 2016, 06:27

My code:

Code: Select all

SFSConnection::SFSConnection()
{
   mSmartFox   = boost::shared_ptr<Sfs2X::SmartFox>();
}

boost::shared_ptr<Sfs2X::SmartFox> SFSConnection::mSmartFox = NULL;
void SFSConnection::initServer( )
{
    CCLOG("Smartfox: Init Server");
    if(mSmartFox)
    {
        mSmartFox->RemoveAllEventListeners();
        //delete boost::shared_ptr<Sfs2X::SmartFox>( mSmartFox);
        mSmartFox = nullptr;
    }
   // Initialize Smart Fox
   mSmartFox = boost::shared_ptr<Sfs2X::SmartFox>(new Sfs2X::SmartFox(true));
   mSmartFox->ThreadSafeMode(true);
    mSmartFox->Debug(true);

   // Add event listeners
    mSmartFox->AddEventListener(SFSEvent::CONNECTION
                                , boost::shared_ptr<EventListenerDelegate> (new EventListenerDelegate(SFSConnection::OnSmartFoxConnection, (unsigned long long)this)));
   mSmartFox->AddEventListener(SFSEvent::LOGIN
                                , boost::shared_ptr<EventListenerDelegate> (new EventListenerDelegate(SFSConnection::OnSmartFoxLogin, (unsigned long long)this)));
    mSmartFox->AddEventListener(SFSEvent::LOGIN_ERROR
                                , boost::shared_ptr<EventListenerDelegate> (new EventListenerDelegate(SFSConnection::OnSmartFoxLoginError, (unsigned long long)this)));
   }

//connect server
void SFSConnection::connectToServer(char const* p_sHostIp, int p_iPort )
{
//    I call IPv4
    mSmartFox->Connect(p_sHostIp, p_iPort);
}

void SFSConnection::OnSmartFoxConnection(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent)
{
    CCLOG("OnSmartFoxConnection Ok & call login");
    SFSConnection::getInstance()->loginTest();
}

void SFSConnection::OnSmartFoxLogin(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent)
{
    CCLOG("OnSmartFoxLogin");
}

void SFSConnection::OnSmartFoxLoginError(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent)
{
    CCLOG("OnSmartFoxLoginError");
}

void SFSConnection::loginTest()
{
    //send requeste
    boost::shared_ptr<IRequest> request (new LoginRequest("", "", "Zone_Name"));
    mSmartFox->Send( request );
}



First, I call SFSConnection::connectToServer to connect socket server.
When Connection is Successful, I received SFSConnection::OnSmartFoxConnection. Here, I call login server with SFSConnection::loginTest().
Case 1: Device connect IPv4 -> SFSConnection::OnSmartFoxLogin or SFSConnection::OnSmartFoxLoginError will be called. -> OK
Case 2: Device connect IPv6 -> Silent, I don't receive anything.

Please give me ideas.
Thanks!
User avatar
Bax
Site Admin
Posts: 4393
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: IPv6 support

Postby Bax » 26 Jul 2016, 08:02

We need to investigate. We'll let you know as soon as possible (this could take a while because our C++ guy is on vacation at the moment).
One last question. What if you connect to localhost? Same issue?
Paolo Bax
The SmartFoxServer Team
jack90
Posts: 4
Joined: 25 Jul 2016, 14:01

Re: IPv6 support

Postby jack90 » 26 Jul 2016, 12:07

When I connect to local, I use case Test 2 & I see same problem.

Thanks
nepoez
Posts: 34
Joined: 13 Aug 2016, 04:28

Re: IPv6 support

Postby nepoez » 13 Aug 2016, 04:34

Hello.

I have deployed SmartFox Server with latest patch 2.11.1 to an EC2 server.
I deployed AdvanceConnector Unity Sample to an Android Device, entered the domain name of the server and it works fine.
However, when setup a IPv6 environment like in example 3(viewtopic.php?f=18&t=18486)

I cannot connect. Please see the attachment for error messages.

Is this Android and iOS via SmartFox not compatible with IPv6?

Thank you.
Attachments
Screenshot_2016-08-13-12-25-53.jpg
(104.79 KiB) Not downloaded yet
Screenshot_2016-08-13-12-25-44.jpg
(104.38 KiB) Not downloaded yet
Screenshot_2016-08-13-12-25-08.jpg
(104.96 KiB) Not downloaded yet
nepoez
Posts: 34
Joined: 13 Aug 2016, 04:28

Re: IPv6 support

Postby nepoez » 13 Aug 2016, 05:14

Hello, when in IPv6 Environment Running the Advanced Connector Unity example works for iOS, but does not work for Android.

I'm using server 2.11.1 and client 1.6.5.

Here is the logcat error:

08-13 01:12:09.022 11324 11346 I Unity : [SFS > ERROR] [TCPSocketLayer] Connection error: Network is unreachable at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy) [0x00000] in <filename unknown>:0
08-13 01:12:09.022 11324 11346 I Unity : at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
08-13 01:12:09.022 11324 11346 I Unity : at System.Net.Sockets.TcpClient.Connect (System.Net.IPEndPoint remote_end_point) [0x00000] in <filename unknown>:0
08-13 01:12:09.022 11324 11346 I Unity : at System.Net.Sockets.TcpClient.Connect (System.Net.IPAddress[] ipAddresses, Int32 port) [0x00000] in <filename unknown>:0
08-13 01:12:09.022 11324 11346 I Unity :
08-13 01:12:09.022 11324 11346 I Unity : (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
08-13 01:12:09.022 11324 11346 I Unity :
08-13 01:12:09.022 11324 11346 I Unity : [SFS > ERROR] ## BlueBox Error: Http error creating http connection: System.Net.Sockets.SocketException: Network is unreachable
08-13 01:12:09.022 11324 11346 I Unity : at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy) [0x00000] in <filename unknown>:0
08-13 01:12:09.022 11324 11346 I Unity : at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
08-13 01:12:09.022 11324 11346 I Unity : at System.Net.Sockets.TcpClient.Connect (System.Net.IPEndPoint remote_end_point) [0x00000] in <filename unknown>:0
08-13 01:12:09.022 11324 11346 I Unity : at System.Net.Sockets.TcpClient.Connect (System.Net.IPAddress[] ipAddresses, Int32 port) [0x00000] in <filename unknown>:0
08-13 01:12:09.022 11324 11346 I Unity :
08-13 01:12:09.022 11324 11346 I Unity : (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
nepoez
Posts: 34
Joined: 13 Aug 2016, 04:28

Re: IPv6 support

Postby nepoez » 13 Aug 2016, 05:26

Just wanted to add. For Android, it will work if you use .net subset, but not the full .net 2.0 in Unity's API compatibility level build settings. Which is a problem because my games require selecting .net 2.0, not the subset.
User avatar
Lapo
Site Admin
Posts: 20146
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: IPv6 support

Postby Lapo » 13 Aug 2016, 09:02

Hi,
the domain showed in the screenshot you have posted doesn't seem to have a SmartFoxServer running on port 9933.
In fact if I telnet the address at port 9933 I am not able to connect.

Have you turned off the server? If not, there must be an active firewall stopping external connections.

Also I am not sure why you are referring to IPv6, the domain you're using does not have any AAAA records so it's not reachable via IPv6.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
nepoez
Posts: 34
Joined: 13 Aug 2016, 04:28

Re: IPv6 support

Postby nepoez » 13 Aug 2016, 13:26

Hello. The server is still running. The sample app still connects just fine. Im not sure if its because the dns hasnt propagated to your region yet.

The server is on amazon ec2 so there is no ipv6 but that is according to scenario #3 in the original post where you setup an ipv6 mac internet sharing then a client will use this network to connect to an external server on ipv4.

I am reporting that this test case does in fact work as the OP claimed that it does. However if in unity android you choose ".net 2.0" instead of ".net subset" then scenario #3 will not connect.
nepoez
Posts: 34
Joined: 13 Aug 2016, 04:28

Re: IPv6 support

Postby nepoez » 13 Aug 2016, 18:03

Here's a few test cases that you might find interesting.

Advanced Connector using 1.6.5 c# client and 2.11.1 server on Amazon EC2 on IPv4 network. Connecting via a domain name.

On armv7 Android device:
-------
mono .net subset connects and logs in.
mono .net 2.0 will NOT connect.
il2cpp .net subset connects and logs in.
il2cpp .net 2.0 connects and logs in.


On x86 Android Device:
-------
mono .net subset connects and logs in.
mono .net 2.0 will NOT connect.
il2cpp .net 2.0 will NOT connect but if you turn off the wifi and turn it back on or switch to a different ipv4 wifi network, for some reason it connects fine after.
il2cpp .net subset will I think behave the same way as above but I ran out of time to test.

I think iOS everything works as expected.


All the above tests are 100% reproducible and not intermittent behaviors.
User avatar
Lapo
Site Admin
Posts: 20146
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: IPv6 support

Postby Lapo » 15 Aug 2016, 10:10

Hello,
Hello. The server is still running. The sample app still connects just fine. Im not sure if its because the dns hasnt propagated to your region yet.

Well, I've tried again and there's no response at the domain used in your tests for TCP port 9933.
I tested from our office in Italy, from one of our servers hosted in the U.S. and from a VPN server based in the Netherlands. Same results, no servers responding on that port.

So I am kind of confused as regards the settings of the test you're doing. Maybe this has nothing to do with your problem (as I would expect) but I also would expect to be able to reach the server that you're using for testing, which is not the case.

If you prefer to talk about those privately you can send us an email to our support@... email box with a reference to this conversation.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
nepoez
Posts: 34
Joined: 13 Aug 2016, 04:28

Re: IPv6 support

Postby nepoez » 15 Aug 2016, 16:31

Hi. Yes I turned off the server already since I was finished with the test case #3. As I stated, test case #3 in fact works as the OP claimed in the original post, with the caveats that I pointed out. What are your thoughts on my findings?
User avatar
Lapo
Site Admin
Posts: 20146
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: IPv6 support

Postby Lapo » 15 Aug 2016, 16:49

Hello,
at the moment I don't know.
The tests were run for iOS specifically, since those are the Apple guidelines for publishing on their store.
I am not aware that Android has switched to a mandatory IPv6 like Apple did, unless something has changed very recently, and therefore I am not sure that your failed test should raise any particular concern.

From your report it seems like this is an issue in Unity and it's pretty bizarre one, I should add, as one would expect that the full .Net 2.0 export should provide a larger (and therefore complete) runtime. While in this case you've found that only a subset of the runtime renders IPv6 usable. Pretty odd.

If you still have your test environment available I would ask you to try a simple HTTP connection (using IPv6) to a website (such as yahoo.com), for example using the WWW class, and see if it shows the same issue (IPv6 working with .Net subset and not working with .Net 2.0 when exported to Android

If the test shows the same result I would conclude it's a Unity issue. Maybe something that will be ironed out when IPv6 becomes mandatory for Android too.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
nepoez
Posts: 34
Joined: 13 Aug 2016, 04:28

Re: IPv6 support

Postby nepoez » 15 Aug 2016, 17:07

No there's not mandate for Android with ipv6. I did it just to ensure it will work down the road if they change the policy. For now it seems to me SmartFox will work for me. Just though I'll post this finding to save you some work later on.

Thanks!

P.S. What do you think about the realtime performance Smartfox 2X compared to ElectroTank(which is gone now, reason for me to look into SmartFox)

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 15 guests