UDP and Disconnect
UDP and Disconnect
So i created a custom login and every time a user tries to login and he's already logged in, i just disconnect him and let the login proceed. It used to work just fine, one client would drop and the other would just login.
The problem is, now i'm using UDP and when the second client connects (after the first client gets disconnected), it can't initialize the UDP anymore. Instead, the server just hangs for a few seconds and disconnects the second client too.
I got the udp working and this problem only occurs when the user is already logged and my custom login disconnects him so the same user can connect from somewhere else.
Any idea on how to solve this? Maybe another way to disconnect/login a client if he's already logged in?
I'm using unity as client by the way.
The problem is, now i'm using UDP and when the second client connects (after the first client gets disconnected), it can't initialize the UDP anymore. Instead, the server just hangs for a few seconds and disconnects the second client too.
I got the udp working and this problem only occurs when the user is already logged and my custom login disconnects him so the same user can connect from somewhere else.
Any idea on how to solve this? Maybe another way to disconnect/login a client if he's already logged in?
I'm using unity as client by the way.
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Do you have a small repro case that I can run here in my end?
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Follow on twitter: http://twitter.com/thomas_h_lund
I'm at work, so I don't have access to my code right now, but here's basically what it is in my custom login handler:
In the Unity client I have InitUDP called in the OnLogin function just like in your FPS example. Everything works fine if i comment out, but I'm not able to log a user off if he's logging in from somewhere else without the server losing responsiveness.
Let me know if this is enough info.. otherwise, I'll be home later and can give you more details. Thanks.[/code]
Code: Select all
public class LoginEventHandler extends BaseServerEventHandler
{
public void handleServerEvent(ISFSEvent event) throws SFSException
{
String name = (String) event.getParameter(SFSEventParam.LOGIN_NAME);
Zone zone = getParentExtension().getParentZone();
User user = zone.getUserByName(name);
if (user != null)
{
getApi().disconnectUser(user);
}
// Proceed with login...
In the Unity client I have InitUDP called in the OnLogin function just like in your FPS example. Everything works fine if i comment out
Code: Select all
getApi().disconnectUser(user);
Let me know if this is enough info.. otherwise, I'll be home later and can give you more details. Thanks.[/code]
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Sounds like the same as here viewtopic.php?t=10205
So some bug in reconnecting a connected/disconnected connection (phew - what a sentence). Possibly UDP only.
Will put it on my todo list. I got a quite hectic week this week before GDC - launching a game. So most likely will not be looked at before weekend. Hope thats ok
/T
So some bug in reconnecting a connected/disconnected connection (phew - what a sentence). Possibly UDP only.
Will put it on my todo list. I got a quite hectic week this week before GDC - launching a game. So most likely will not be looked at before weekend. Hope thats ok
/T
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Follow on twitter: http://twitter.com/thomas_h_lund
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Yeh - been looking at it, and the bigger fix will take a little extra time + discussions with the server guys.
You more or less can work around the issue. Dont rely on the callback from InitUDP, but check if udp is inited and then do what you would otherwise have done.
UDP stays initialized after a logout - thats the thing biting you.
So if you e.g. usually in your login sequence join the lobby after initializing network, then do something like this:
You more or less can work around the issue. Dont rely on the callback from InitUDP, but check if udp is inited and then do what you would otherwise have done.
UDP stays initialized after a logout - thats the thing biting you.
So if you e.g. usually in your login sequence join the lobby after initializing network, then do something like this:
Code: Select all
if (!smartFox.UdpInited) {
smartFox.InitUDP(serverName, serverPort);
}
else {
JoinLobby();
}
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Follow on twitter: http://twitter.com/thomas_h_lund
heh, great... i've spent a month trying to figure out what was causing my server to not accept more connections and today I find it and I see it was a known issue grrrr
The problem is that doing this temporary fix would require to modify all my clients, which would take a couple weeks to propagate. So it's a bit of a pain. So far what I've done is create a windows server that every 5 minutes connects to the server and in case it fails, it will restart the smartfox insntace.
Any plans on releasing an update with a fix for this soon?
The problem is that doing this temporary fix would require to modify all my clients, which would take a couple weeks to propagate. So it's a bit of a pain. So far what I've done is create a windows server that every 5 minutes connects to the server and in case it fails, it will restart the smartfox insntace.
Any plans on releasing an update with a fix for this soon?
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
I do not know the plans for next release.
/me looks at Marco
/me looks at Marco
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Follow on twitter: http://twitter.com/thomas_h_lund
Who is online
Users browsing this forum: No registered users and 60 guests