Ok,
After some times, now I'm getting a consistent error flow.
Here is my configuration:
Server and client are on the same machine. No firewalls neither antivirus running.
Server:
Windows 10
Smartfox 2.13.4
SpaceWar extensions
Socket Addresses: 0.0.0.0:9933 TCP and 0.0.0.0:9999 UDP
bootlog:
Code: Select all
D:\sfs2eval\SpaceWar\SmartFoxServer_2X\SFS2X>sfs2x.bat
16:49:03,532 INFO [main] v2.SmartFoxServer - Boot sequence starts...
16:49:03,810 INFO [main] core.SFSEventManager - AnonymousService-1 initialized
16:49:03,824 INFO [main] impl.DefaultFileReplicator - Using "C:\Users\JACOBO~1.ROD\AppData\Local\Temp\vfs_cache" as temporary files store.
16:49:03,861 INFO [main] v2.SmartFoxServer - License loaded:
==========================================
LICENSE DETAILS
------------------------------------------
Type : Community Edition
Max users : 100
==========================================
16:49:03,862 INFO [main] managers.SFSBannedUserStorage - BanUserStorage initialized
16:49:03,869 INFO [main] managers.SFSBannedUserManager - BanUser data loaded: 0 records.
16:49:03,872 INFO [main] v2.SmartFoxServer - Protocol Type is: BINARY
16:49:03,874 INFO [main] config.DefaultConfigLoader - Loading: zones\BasicExamples.zone.xml
16:49:03,888 INFO [main] config.DefaultConfigLoader - Loading: zones\SpaceWar.zone.xml
16:49:03,899 INFO [main] managers.SFSZoneManager -
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>> Zone: BasicExamples
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
16:49:03,917 INFO [main] managers.SFSRoomManager - Room created: { Zone: BasicExamples }, [ Room: The Lobby, Id: 0, Group: default, isGame: false ], type = SFSRoom
16:49:03,918 INFO [main] managers.SFSZoneManager -
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>> Zone: SpaceWar
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
16:49:03,921 INFO [main] managers.SFSRoomManager - Room created: { Zone: SpaceWar }, [ MMORoom: Sol, Id: 1, Group: default, AOI: (900, 750, 0) ], type = MMORoom
16:49:03,961 INFO [main] managers.SFSRoomManager - Room created: { Zone: --=={{{ AdminZone }}}==-- }, [ Room: AdminRoom, Id: 2, Group: default, isGame: false ], type = SFSRoom
16:49:03,984 INFO [main] core.AdminToolService - AdminTool Service started
16:49:04,117 INFO [SFSWorker:Sys:1] v2.SmartFoxServer - Listening Sockets: { 0.0.0.0:9933, (Tcp) } { 0.0.0.0:9999, (Udp) }
16:49:04,117 INFO [SFSWorker:Sys:1] v2.SmartFoxServer -
_____ _____ _____ ___ __ __
| __| __| __| |_ | | |
|__ | __|__ | | _|- -|
|_____|__| |_____| |___|__|__|
_____ _____ _____ ____ __ __
| __ | __| _ | \| | |
| -| __| | | |_ _|
|__|__|_____|__|__|____/ |_|
[ 2.13.4 ]
16:49:04,118 INFO [SFSWorker:Sys:1] v2.SmartFoxServer - SmartFoxServer 2X (2.13.4) READY!
16:49:04,674 INFO [main] v3.SessionFilter - BlueBox-2X Service (3.3.0) READY.
16:49:50,734 INFO [SocketReader] sessions.DefaultSessionManager - Session created: { Id: 1, Type: DEFAULT, Logged: No, IP: 0:0:0:0:0:0:0:1:56003 } on Server port: 9933 <---> 56003
16:49:50,746 INFO [SocketReader] sessions.DefaultSessionManager - Session removed: { Id: 1, Type: DEFAULT, Logged: No, IP: 0:0:0:0:0:0:0:1:56003 }
16:49:50,751 INFO [SocketReader] sessions.DefaultSessionManager - Session created: { Id: 2, Type: DEFAULT, Logged: No, IP: 0:0:0:0:0:0:0:1:56004 } on Server port: 9933 <---> 56004
16:49:50,802 INFO [SFSWorker:Ext:4] api.SFSApi - User login: { Zone: --=={{{ AdminZone }}}==-- }, ( User Name: sfsadmin, Id: 0, Priv: 0, Sess: 0:0:0:0:0:0:0:1:56004 ) , Type: Flash ActiveX:WIN 32,0,0,114
16:49:50,805 INFO [SFSWorker:Ext:4] api.SFSApi - Room joined: [ Room: AdminRoom, Id: 2, Group: default, isGame: false ], { Zone: --=={{{ AdminZone }}}==-- }, ( User Name: sfsadmin, Id: 0, Priv: 0, Sess: 0:0:0:0:0:0:0:1:56004 ) , asSpect: false
Client:
Windows 10
Visual Studio 2017 (vstoolkit 140)
Client API version: 1.7.5
Connection Process:
SpaceWar login process, almost unmodified but with the following changes
Code: Select all
#define SERVER_IP "127.0.0.1"
#define SERVER_PORT 9999
void ServerConnector::connect()
{
boost::shared_ptr<Sfs2X::Util::ConfigData> data(new Sfs2X::Util::ConfigData);
data->Host(SERVER_IP);
data->Port(9933);
data->UdpHost(SERVER_IP);
data->UdpPort(SERVER_PORT);
data->Debug(true);
data->Zone("SpaceWar");
m_smartFoxServer->Connect(data);
}
void LoginScene::setAppDelegate(AppDelegate * appDelegate)
{
BaseScene::setAppDelegate(appDelegate);
getSmartFox()->AddEventListener(SFSEvent::LOGIN, boost::shared_ptr<EventListenerDelegate>(new EventListenerDelegate(OnLogin, (unsigned long long)this)));
getSmartFox()->AddEventListener(SFSEvent::LOGIN_ERROR, boost::shared_ptr<EventListenerDelegate>(new EventListenerDelegate(OnLoginError, (unsigned long long)this)));
[b]getSmartFox()->AddEventListener(SFSEvent::UDP_INIT, boost::shared_ptr<EventListenerDelegate> (new EventListenerDelegate(LoginScene::onUDPInit, (unsigned long long)this)));[/b]
}
void OnLogin(unsigned long long context, boost::shared_ptr<BaseEvent> evt) {
LoginScene *loginScene = (LoginScene *)context;
AppDelegate* appDelegate = loginScene->getAppDelegate();
boost::shared_ptr<Sfs2X::SmartFox> sfs = loginScene->getSmartFox();
CCLOG("Enable lag monitor");
sfs->EnableLagMonitor(true, 1, 5);
boost::shared_ptr<std::string> version = sfs->Version();
sfs->InitUDP();
.
.
.
.
}
Those are all the changes I've made to the SpaceWar sources and in the Admin Tool.
Now, what is happening, is that when InitUPD is called, it spends a lot of minutes and finally it gets disconnected from the server (the session is lost) but the game thinks it's still connected and is sending messages to the server, that eventually fails because there is no session established between the client and the server. I don't care very much about this error, as I understand SpaceWar is just an example of how to use the API and not all error paths are controlled. What is giving me headaches is the fact that the session is lost after a lot of minutes and I can't get a working UPD connection (but a normal TCP connection works without problems)
This is the server log after the error have happened
Code: Select all
_____ _____ _____ ___ __ __
| __| __| __| |_ | | |
|__ | __|__ | | _|- -|
|_____|__| |_____| |___|__|__|
_____ _____ _____ ____ __ __
| __ | __| _ | \| | |
| -| __| | | |_ _|
|__|__|_____|__|__|____/ |_|
[ 2.13.4 ]
16:59:19,863 INFO [SFSWorker:Sys:1] v2.SmartFoxServer - SmartFoxServer 2X (2.13.4) READY!
16:59:20,354 INFO [main] v3.SessionFilter - BlueBox-2X Service (3.3.0) READY.
16:59:32,157 INFO [SocketReader] sessions.DefaultSessionManager - Session created: { Id: 1, Type: DEFAULT, Logged: No, IP: 0:0:0:0:0:0:0:1:56200 } on Server port: 9933 <---> 56200
16:59:32,191 INFO [SFSWorker:Ext:4] api.SFSApi - User login: { Zone: --=={{{ AdminZone }}}==-- }, ( User Name: sfsadmin, Id: 0, Priv: 0, Sess: 0:0:0:0:0:0:0:1:56200 ) , Type: Flash ActiveX:WIN 32,0,0,114
16:59:32,195 INFO [SFSWorker:Ext:4] api.SFSApi - Room joined: [ Room: AdminRoom, Id: 2, Group: default, isGame: false ], { Zone: --=={{{ AdminZone }}}==-- }, ( User Name: sfsadmin, Id: 0, Priv: 0, Sess: 0:0:0:0:0:0:0:1:56200 ) , asSpect: false
16:59:39,972 INFO [SocketReader] sessions.DefaultSessionManager - Session created: { Id: 2, Type: DEFAULT, Logged: No, IP: 127.0.0.1:56208 } on Server port: 9933 <---> 56208
[b]16:59:44,235 INFO [SFSWorker:Ext:1] api.SFSApi - User login: { Zone: SpaceWar }, ( User Name: jacobo, Id: 1, Priv: 0, Sess: 127.0.0.1:56208 ) , Type: C++ API
17:01:49,903 INFO [SocketReader] sessions.DefaultSessionManager - Session removed: { Id: 2, Type: DEFAULT, Logged: Yes, IP: 127.0.0.1:56208 }[/b]
17:01:49,904 INFO [SFSWorker:Sys:1] api.SFSApi - User disconnected: { Zone: SpaceWar }, ( User Name: jacobo, Id: 1, Priv: 0, Sess: 127.0.0.1:56208 ) , SessionLen: 125669, Type: C++ API
17:01:49,933 INFO [SocketReader] sessions.DefaultSessionManager - Session created: { Id: 3, Type: DEFAULT, Logged: No, IP: 127.0.0.1:56236 } on Server port: 9933 <---> 56236
17:02:29,980 INFO [Scheduler1-thread-1] sessions.DefaultSessionManager - Session removed: { Id: 3, Type: DEFAULT, Logged: No, IP: 127.0.0.1:56236 }
[b]17:02:30,005 INFO [SocketReader] sessions.DefaultSessionManager - Session created: { Id: 4, Type: DEFAULT, Logged: No, IP: 127.0.0.1:56244 } on Server port: 9933 <---> 56244[/b]
As you can see, the user loses its session and gets disconnected (although later the game is receiving onConnected events, that why it is creating and removing sessions but as the user is logged out they fail. As said, this error doesn't concerns to me as this should be caused by the SpaceWar sample, after a connection error that wasn't correctly handled)
The question is, why can't I get a working UDP connection?
Thanks!