Server Reconnection Issues

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

Posts: 21
Joined: 16 Jul 2010, 17:02

Server Reconnection Issues

Postby ifernandez » 18 Aug 2011, 14:52


I've searched through the forum and found some posts about the same issue, but not quite the same scenario.

I'm working with a long running process with the server using the Unity API, from a C# App, im not inside Unity but in a custom Environment.

The issue is that, i can successfully open a connection to the server, log in, and perform any needed operation. Due to the application way of working, this app will stay open for a long time.

As expected after a certain amount of time of inactivity the server drops my connection, and close the session, sending the user the CONNECTION_LOST event.

But after that when i need the connection back, and after the confirmation that the previous connection was dropped i try to connect to to the server again. The server initiates the connection, and register the attempt. But no Client Side Connection Event is Fired. And the server Drops the connection after little time. Printing an error to the Console. That happens every time i try to reconnect using that Application Instance. But if i completely close the App, and open it again, everything work as expected.

Modifying the Log Level for the server i see that the Handshake is processed and sent back to the client, but the connection event is never received.

The message Printed by the server after this is:

[SFS - ERROR] TCPSocketLayer: Connection closed by the remote side

I can upload testing code, and the server log if needed.

Posts: 68
Joined: 28 Dec 2010, 08:54

Postby COB » 18 Aug 2011, 18:49

I noticed similar thing and this problem was described also here:
and here by me in discussion about reconnection mechanism (however, I also tried to make manual reconnection mechanism).
Generally, there is a problem with on connection event as you wrote. I still don't have solution for this problem...
Posts: 21
Joined: 16 Jul 2010, 17:02

Postby ifernandez » 18 Aug 2011, 19:03

I'm trying to find more information about this issue, but right now i don't have any solution to this.

I'm not using the reconnection mechanism in the server, the way connections work for me is kind of different, and i will need to set up a connection on demand, a persistent connection won't work well for my purposes.

Checking the Server Logs, changing all the loggers to a DEBUG level, does give me more information about what happens, but still the client receives the handshake packet, and no CONNECTION event is fired.

It's similar to the problem described here:

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 4 guests