We just released v1.7.16 of the SFS2X C# client API for Unity / .Net / Mono / Universal Windows Platform.
This new version fixes a crash which could occur in Unity's Android build with il2cpp, due to a Console.WriteLine instruction in the API internal logger.
You can download the API at this url: https://www.smartfoxserver.com/download/sfs2x#p=client
New C# API v1.7.16 released
New C# API v1.7.16 released
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: New C# API v1.7.16 released
Are the separate DotNet DLLs definitely free from the Unity dependency? Downloaded the client API today and wrote a simple test program that just connects to a server with some Console.WriteLines for logging, but I'm getting the following exception right after establishing my connection:
For reference, my csproj file is:
And the full program:
I don't actually see my event handlers' logs, but server-side I see a session get created and then immediately removed when I run the code.
Code: Select all
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
at Sfs2X.Logging.Logger.Log(LogLevel level, String message)
at Sfs2X.Logging.Logger.Error(String[] messages)
at Sfs2X.Bitswarm.BitSwarmClient.OnSocketData(Byte[] data)
at Sfs2X.Core.ThreadManager.ProcessItem(Hashtable item)
at Sfs2X.Core.ThreadManager.InThread()
at System.Threading.Thread.StartCallback()
For reference, my csproj file is:
Code: Select all
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>
<Reference Include="SmartFox2X">
<HintPath>../SFS2X/Debug/DotNet/SmartFox2X.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
And the full program:
Code: Select all
using Sfs2X; // SmartFox
using Sfs2X.Core; // BaseEvent, SFSEvent
using Sfs2X.Util; // ConfigData
class Client {
SmartFox sfs;
public bool IsGood { get; private set; } = true;
public static void Main() {
Client client = new Client();
while (client.IsGood) {
Thread.Sleep(500);
}
Console.WriteLine("Exiting...");
}
public Client() {
sfs = new SmartFox();
// Add event listeners
sfs.AddEventListener(SFSEvent.CONNECTION, OnConnection);
sfs.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost);
// Connect
ConfigData cfg = new ConfigData() {
Host = "127.0.0.1",
Port = 9933,
Zone = "TestZone",
};
sfs.Connect(cfg);
}
~Client() {
if (sfs.IsConnected)
sfs.Disconnect();
}
// Event Handlers
private void OnConnection(BaseEvent evt) {
if ((bool)evt.Params["success"]) {
Console.WriteLine("Connection established successfully");
Console.WriteLine("SFS2X API Version: " + sfs.Version);
}
else {
Console.WriteLine("Connection failed");
IsGood = false;
}
}
private void OnConnectionLost(BaseEvent evt) {
IsGood = false;
Console.WriteLine("Connection lost: " + (string)evt.Params["reason"]);
}
}
I don't actually see my event handlers' logs, but server-side I see a session get created and then immediately removed when I run the code.
Re: New C# API v1.7.16 released
It looks like we made a mistake creating the zip file for the download section of our website. We now fixed it.
Please download the C# API again. Sorry.
Please download the C# API again. Sorry.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: New C# API v1.7.16 released
That solved it, thanks for the speedy fix!
Who is online
Users browsing this forum: No registered users and 44 guests