In my application,I will judge the current connection status. in the function OnConnectionLost,I give a debug smartfox.IsConnected ,It is true! and After the connection is lost(server log display disconnect,and client log also give information that OnConnectionLost is executed). So After the connection is lost , I can't reconnect to server. I have open HRC to 15 seconds.
server:2.5
client :unity c# the newest.
smartfox.IsConnected is true after OnConnectionLost
Re: smartfox.IsConnected is true after OnConnectionLost
Hello,
What is the SFS Unity C# Client Api version you're using?
Please make sure you're using the latest 1.0.6
You can get it from:
http://www.smartfoxserver.com/download/sfs2x#p=updates
What is the SFS Unity C# Client Api version you're using?
Please make sure you're using the latest 1.0.6
You can get it from:
http://www.smartfoxserver.com/download/sfs2x#p=updates
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Re: smartfox.IsConnected is true after OnConnectionLost
rjgtav wrote:Hello,
What is the SFS Unity C# Client Api version you're using?
Please make sure you're using the latest 1.0.6
You can get it from:
http://www.smartfoxserver.com/download/sfs2x#p=updates
It's very strange that the newest Unity C# Client Api version(perhaps version1.0.6, I checked that dll create time:2012.12.29) is wrong (in OnConnectionLost function ,smartFox.IsConnected is true)
but the old version (dll created time:2012.4.9 ) is right(smartFox.IsConnected is false in OnConnectionLost)
now I have to go back to this old version.(server version 2.5 linux 64 bit(cent os 6.3 64 bit),,unity version: 3.5.5)
Re: smartfox.IsConnected is true after OnConnectionLost
I've made a few posts on this issue, but it seems a tough bug to fix. Or at least to keep fixed, as it was working correctly in client API 1.0.3! So that is what I keep using, luckily I have no great need for the newer versions. Note that with 1.0.3 the CONNECTION_LOST event gets fired twice, so it is possible that the "fix" in that version is actually a side effect (or the other way around).
I have sent ThomasLund a PM about this about 1.5 week ago, but I did not get any reply. If anyone from the team wants to pick it up, I'd be happy to forward the PM, which includes a sample project and long description for your convenience.
I have sent ThomasLund a PM about this about 1.5 week ago, but I did not get any reply. If anyone from the team wants to pick it up, I'd be happy to forward the PM, which includes a sample project and long description for your convenience.
Re: smartfox.IsConnected is true after OnConnectionLost
Micr0mega wrote:I've made a few posts on this issue, but it seems a tough bug to fix. Or at least to keep fixed, as it was working correctly in client API 1.0.3! So that is what I keep using, luckily I have no great need for the newer versions. Note that with 1.0.3 the CONNECTION_LOST event gets fired twice, so it is possible that the "fix" in that version is actually a side effect (or the other way around).
I have sent ThomasLund a PM about this about 1.5 week ago, but I did not get any reply. If anyone from the team wants to pick it up, I'd be happy to forward the PM, which includes a sample project and long description for your convenience.
I want it.please email :zhouzhongcheng_sz@163.com
Thanks
Re: smartfox.IsConnected is true after OnConnectionLost
zzc11414 wrote:I want it.please email :zhouzhongcheng_sz@163.com
Thanks
You realize that the mentioned sample project I created contains the error, not the solution? Seems you already know about the error, right?
Re: smartfox.IsConnected is true after OnConnectionLost
I want to produce your problem,and compare with mine
- nekokiller
- Posts: 24
- Joined: 23 Oct 2012, 10:13
Re: smartfox.IsConnected is true after OnConnectionLost
Is there anybody work on Unity crash problem ?
Re: smartfox.IsConnected is true after OnConnectionLost
This looks like a double post. I have already replied to an almost identical issue.
Yes, we filed the problem under our bug database and we're going to release an update.
Yes, we filed the problem under our bug database and we're going to release an update.
Re: smartfox.IsConnected is true after OnConnectionLost
UPDATE:
We have a preview release of the Unity API that fixes several issues as discussed in this forums.
Please make sure to download the DLL and try it in your project.
Please let us know if it fixes your problems.
We have a preview release of the Unity API that fixes several issues as discussed in this forums.
Please make sure to download the DLL and try it in your project.
Please let us know if it fixes your problems.
- nekokiller
- Posts: 24
- Joined: 23 Oct 2012, 10:13
Re: smartfox.IsConnected is true after OnConnectionLost
Hi, Lapo:
Fisrt, Thank you very much!
I have download your SFS2X_CSharp_1.0.9, put the SmartFox2.dll in the Plugins folder, and do testing in my FreezeProblem Unity Project.
Good news is : No Freeze Problem any more ~ I have try lots of times, there is no freeze problem.
And the IsConnected flag is true now ( when connection lost event happened ) , the flag works fine now.
But... there are some other problem happened.
My testing scenario:
step 1. run unity project, do connect to smart fox server, and the connesion will success
step 2. use SmartFoxServer Admin Tool, click 'Kick' button to kick user.
step 3. back to unity , client side got a warning:
TCP SocketLayer: INSIDE HANDLE DISCONNECTION, TCP SOCKET LAYER-----------------------
And my debug log show the connection lost reason :
OnConnectionLost! reason: unknown
The first little problem is : the reason string is 'unknown' now, it was 'kick' in last SmartFox Dll version.
So I can not exactly tell the user what is the real reason for this connect lost event.
step 4. do Connect again from client side:
If I wait for a long time before do connect, the connection will build successful and works fine.
But if I do connect quickly ( after connection lost happened in 1~10 seconds ) , I got this three warnings:
TCPSocketLayer: General error reading data from socket: Read failure at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
at Sfs2X.Core.Sockets.TCPSocketLayer.Read () [0x00000] in <filename unknown>:0
General error reading data from socket: Read failure at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
at Sfs2X.Core.Sockets.TCPSocketLayer.Read () [0x00000] in <filename unknown>:0 ==> NotSocket
TCPSocketLayer: INSIDE HANDLE DISCONNECTION, TCP SOCKET LAYER---------------------------
UnityEngine.Debug:Log(Object)
step 5: When this three warnings happened, I do Connect again and again, I got this smart fox 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)
Step6: Stop the unity project, and redo Step 1 to Step 3
new Step 4: After connection lost event happened ( kick from server ), do Disconnect() first.
new Step 5: do Connect(), the connection will build successful some times. But some times will got this warning:
A connection attempt is already in progress
UnityEngine.Debug:Log(Object)
SmartFoxClient:onSfsWarnLogged(BaseEvent) (at Assets/Scripts/SmartFoxClient.cs:101)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
Finally, the testing result of the SFS2X_CSharp_1.0.9 version:
No freeze problem, IsConnected flag works fine.
Some times connection works fine, but some times it throws warning or error in connection.
Do disconnect() when connection lost event happend, this can help the next connection build more successful.
Fisrt, Thank you very much!
I have download your SFS2X_CSharp_1.0.9, put the SmartFox2.dll in the Plugins folder, and do testing in my FreezeProblem Unity Project.
Good news is : No Freeze Problem any more ~ I have try lots of times, there is no freeze problem.
And the IsConnected flag is true now ( when connection lost event happened ) , the flag works fine now.
But... there are some other problem happened.
My testing scenario:
step 1. run unity project, do connect to smart fox server, and the connesion will success
step 2. use SmartFoxServer Admin Tool, click 'Kick' button to kick user.
step 3. back to unity , client side got a warning:
TCP SocketLayer: INSIDE HANDLE DISCONNECTION, TCP SOCKET LAYER-----------------------
And my debug log show the connection lost reason :
OnConnectionLost! reason: unknown
The first little problem is : the reason string is 'unknown' now, it was 'kick' in last SmartFox Dll version.
So I can not exactly tell the user what is the real reason for this connect lost event.
step 4. do Connect again from client side:
If I wait for a long time before do connect, the connection will build successful and works fine.
But if I do connect quickly ( after connection lost happened in 1~10 seconds ) , I got this three warnings:
TCPSocketLayer: General error reading data from socket: Read failure at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
at Sfs2X.Core.Sockets.TCPSocketLayer.Read () [0x00000] in <filename unknown>:0
General error reading data from socket: Read failure at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
at Sfs2X.Core.Sockets.TCPSocketLayer.Read () [0x00000] in <filename unknown>:0 ==> NotSocket
TCPSocketLayer: INSIDE HANDLE DISCONNECTION, TCP SOCKET LAYER---------------------------
UnityEngine.Debug:Log(Object)
step 5: When this three warnings happened, I do Connect again and again, I got this smart fox 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)
Step6: Stop the unity project, and redo Step 1 to Step 3
new Step 4: After connection lost event happened ( kick from server ), do Disconnect() first.
new Step 5: do Connect(), the connection will build successful some times. But some times will got this warning:
A connection attempt is already in progress
UnityEngine.Debug:Log(Object)
SmartFoxClient:onSfsWarnLogged(BaseEvent) (at Assets/Scripts/SmartFoxClient.cs:101)
Sfs2X.Core.EventDispatcher:DispatchEvent(BaseEvent)
Sfs2X.SmartFox:ProcessEvents()
Finally, the testing result of the SFS2X_CSharp_1.0.9 version:
No freeze problem, IsConnected flag works fine.
Some times connection works fine, but some times it throws warning or error in connection.
Do disconnect() when connection lost event happend, this can help the next connection build more successful.
Re: smartfox.IsConnected is true after OnConnectionLost
Thanks, it looks like is yet another threading issue, specific to Unity.
I tested using a .Net application, outside of Unity for ease of debugging and the reconnections work flawlessly.
We'll do more testing inside the Unity editor.
Thanks
I tested using a .Net application, outside of Unity for ease of debugging and the reconnections work flawlessly.
We'll do more testing inside the Unity editor.
Thanks
Re: smartfox.IsConnected is true after OnConnectionLost
UPDATE:
We've done some testing in Unity and update the preview release. At this moment the problem seems fixed.
Please download it from this address and let us know.
We've done some testing in Unity and update the preview release. At this moment the problem seems fixed.
Please download it from this address and let us know.
- nekokiller
- Posts: 24
- Joined: 23 Oct 2012, 10:13
Re: smartfox.IsConnected is true after OnConnectionLost
Well~ great !
I just download the latest release, and run testing..
Everything works fine..Connection lost reason is correct.
After be kicked , redo connect() is always get success now.
There is no problem.
I just download the latest release, and run testing..
Everything works fine..Connection lost reason is correct.
After be kicked , redo connect() is always get success now.
There is no problem.
Who is online
Users browsing this forum: No registered users and 48 guests