I wrote a tiny script in Unity that exhibits the same problems. Additionally I dispatch a custom event just to see if the dispatcher itself is the problem, but that seems to succeed so the problem is something different:
Code: Select all
public class Client : MonoBehaviour
{
SmartFox sfs;
void Start()
{
sfs = new SmartFox();
// Add event listeners
sfs.AddEventListener(SFSEvent.CONNECTION, (evt) => Debug.Log("Connection"));
sfs.AddEventListener(SFSEvent.CONNECTION_LOST, (evt) => Debug.Log("Connection Lost"));
sfs.AddEventListener("test", (evt) => Debug.Log("Test"));
// Dispatch custom event
sfs.Dispatcher.DispatchEvent(new BaseEvent("test"));
// Connect
ConfigData cfg = new ConfigData() {
Host = "127.0.0.1",
Port = 9933,
Zone = "TestZone",
};
sfs.Connect(cfg);
Debug.Log("Finished init");
}
}
The output from this code is:
Code: Select all
Test
Finished init
And the server logs:
Code: Select all
15:59:44,194 INFO [main] v2.SmartFoxServer - Boot sequence starts...
15:59:44,378 INFO [main] core.SFSEventManager - SFSEventManager initialized
15:59:44,387 INFO [main] impl.DefaultFileReplicator - Using "/tmp/vfs_cache" as temporary files store.
15:59:44,413 INFO [main] v2.SmartFoxServer - License loaded:
==========================================
LICENSE DETAILS
------------------------------------------
Type : Community Edition
Max users : 100
==========================================
15:59:44,414 INFO [main] managers.SFSBannedUserStorage - BanUserStorage initialized
15:59:44,419 INFO [main] managers.SFSBannedUserManager - BanUser data loaded: 0 records.
15:59:44,421 INFO [main] v2.SmartFoxServer - Protocol Type is: BINARY
15:59:44,422 INFO [main] config.DefaultConfigLoader - Loading: zones/BasicExamples.zone.xml
15:59:44,433 INFO [main] config.DefaultConfigLoader - Loading: zones/TestZone.zone.xml
15:59:44,441 INFO [main] managers.SFSZoneManager -
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>> Zone: BasicExamples
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
15:59:44,452 INFO [main] managers.SFSRoomManager - Room created: { Zone: BasicExamples }, [ Room: The Lobby, Id: 0, Group: default, isGame: false ], type = SFSRoom
15:59:44,453 INFO [main] managers.SFSZoneManager -
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>> Zone: TestZone
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
15:59:44,456 INFO [main] managers.SFSRoomManager - Room created: { Zone: --=={{{ AdminZone }}}==-- }, [ Room: AdminRoom, Id: 1, Group: default, isGame: false ], type = SFSRoom
15:59:44,475 INFO [main] core.AdminToolService - AdminTool Service started
15:59:44,496 INFO [SFSWorker:Sys:1] v2.SmartFoxServer - Listening Sockets: { 0.0.0.0:9933, (Tcp) } { 127.0.0.1:9933, (Udp) }
15:59:44,496 INFO [SFSWorker:Sys:1] v2.SmartFoxServer -
_____ _____ _____ ___ __ __
| __| __| __| |_ | | |
|__ | __|__ | | _|- -|
|_____|__| |_____| |___|__|__|
_____ _____ _____ ____ __ __
| __ | __| _ | \| | |
| -| __| | | |_ _|
|__|__|_____|__|__|____/ |_|
[ 2.17.0 ]
15:59:44,496 INFO [SFSWorker:Sys:1] v2.SmartFoxServer - SmartFoxServer 2X (2.17.0) READY!
15:59:45,428 INFO [TomcatRunner] bluebox.BBSessionFilter - BlueBox Service (4.0.2) READY.
16:00:11,737 INFO [SocketReader] sessions.DefaultSessionManager - Session created: { Id: 1, Type: DEFAULT, Logged: No, IP: 127.0.0.1:52830 } on Server port: 9933 <---> 52830
I'm running on Arch Linux, but will test on Windows later today and update this thread with my findings. My server version is 2.17.0, and I'm using the 1.7.16 client API. I was using .NET 6.0 initially, but tried with .NET 4.5 (the lowest version compatible with the client API) and the problem remained the same.
EDIT: Can confirm I get the same experience on Windows with Unity.