Hi~ Lapo:
I got a NullReferenceException when smart fox do connect().
We want to simulate wifi disconnection because of some unknown problem.
Test 1:
step1: unplug the network line. ( simulation about wifi network disconnecting )
step2: do Connect(), this will get two warnings:
TCPSocketLayer: Connection error: No route to host at System.Net.Sockets.Socket.Connect (System.Net.EndPoint
remoteEP, Boolean requireSocketPolicy) [0x00000] in <filename unknown>:0
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
at System.Net.Sockets.Socket.Connect (System.Net.IPAddress address, Int32 port) [0x00000] in <filename unknown>:0
at Sfs2X.Core.Sockets.TCPSocketLayer.ConnectThread () [0x00000] in <filename unknown>:0
Connection error: No route to host at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean
requireSocketPolicy) [0x00000] in <filename unknown>:0
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
at System.Net.Sockets.Socket.Connect (System.Net.IPAddress address, Int32 port) [0x00000] in <filename unknown>:0
at Sfs2X.Core.Sockets.TCPSocketLayer.ConnectThread () [0x00000] in <filename unknown>:0 ==> HostUnreachable
Step3: do Connect() again, then will get this NullReferenceException error:
NullReferenceException: Object reference not set to an instance of an object
Sfs2X.Bitswarm.BitSwarmClient.Connect (System.String ip, Int32 port)
Sfs2X.SmartFox.Connect (System.String host, Int32 port)
Test 2:
Step1: do Connect(), and wait for connection success.
Step2: unplug the network line
Step3: wait for a long time, then do Disconnect();
Step4: do Connect(), will get the NullReferenceException error, too.
ps. smartfox dll: v1.1.0, macOSX: 10.6.8, unity3d: 3.5.7f6
NullReferenceException when connect
- nekokiller
- Posts: 24
- Joined: 23 Oct 2012, 10:13
Re: NullReferenceException when connect
A few things:
1) Disconnecting the wifi when a connection is already running won't trigger any disconnection events. As we explain in our documentation:
(See last section)
2) Are you sure you are running version 1.1.0. That problem has been fixed in that release and as of now I cannot reproduce it.
It stems from not using the external configuration. Maybe download the API again and make sure to remove the old DLL before adding the new one.
Thanks
1) Disconnecting the wifi when a connection is already running won't trigger any disconnection events. As we explain in our documentation:
- NOTE: Do not attempt to test the reconnection system by pulling the ethernet cable or shutting down the WIFI connection. Both operations will not terminate your current socket connections and therefore the disconnection event will never be triggered.
(See last section)
2) Are you sure you are running version 1.1.0. That problem has been fixed in that release and as of now I cannot reproduce it.
It stems from not using the external configuration. Maybe download the API again and make sure to remove the old DLL before adding the new one.
Thanks
Re: NullReferenceException when connect
I get the same NullReferenceException as described above using version 1.6.3 of the DLL in Unity 5.3.3f1.
I am trying to force a failed connection by setting incorrect ports in my configuration.
After the connection has failed I try to connect again and the NullReferenceException appear.
I have noticed that if I do a "new SmartFox()" and work on a new object I can connect again but I would like to avoid this.
NullReferenceException: Object reference not set to an instance of an object
Sfs2X.Bitswarm.BitSwarmClient.Connect (System.String host, Int32 port)
Sfs2X.SmartFox.Connect (System.String host, Int32 port)
Sfs2X.SmartFox.Connect (Sfs2X.Util.ConfigData cfg)
I am trying to force a failed connection by setting incorrect ports in my configuration.
After the connection has failed I try to connect again and the NullReferenceException appear.
I have noticed that if I do a "new SmartFox()" and work on a new object I can connect again but I would like to avoid this.
NullReferenceException: Object reference not set to an instance of an object
Sfs2X.Bitswarm.BitSwarmClient.Connect (System.String host, Int32 port)
Sfs2X.SmartFox.Connect (System.String host, Int32 port)
Sfs2X.SmartFox.Connect (Sfs2X.Util.ConfigData cfg)
Re: NullReferenceException when connect
Hi,
After a connection has been shut down you will need to recreate the SmartFox object.
cheers
davidh wrote:I get the same NullReferenceException as described above using version 1.6.3 of the DLL in Unity 5.3.3f1.
I am trying to force a failed connection by setting incorrect ports in my configuration.
After the connection has failed I try to connect again and the NullReferenceException appear.
I have noticed that if I do a "new SmartFox()" and work on a new object I can connect again but I would like to avoid this.
After a connection has been shut down you will need to recreate the SmartFox object.
cheers
-
- Posts: 2
- Joined: 25 Sep 2019, 18:18
Re: NullReferenceException when connect
Hello Everyone,
Is there any way that we can approach this without creating a new session object every time we disconnect. Thanks
Is there any way that we can approach this without creating a new session object every time we disconnect. Thanks
Re: NullReferenceException when connect
Hi,
sorry no, it is supposed to work this way.
Cheers
sorry no, it is supposed to work this way.
Cheers
Who is online
Users browsing this forum: No registered users and 54 guests