Open timothyparez opened 4 years ago
I have a walk around:
AsyncIO.ForceDotNet.Force();
and
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
NetMQConfig.Cleanup(false);
}
are the solution.
Working example:
using Godot;
using NetMQ;
using NetMQ.Sockets;
namespace RPG
{
public class Main : Node2D
{
private ResponseSocket _server = null!;
private RequestSocket _client = null!;
public override void _Ready()
{
AsyncIO.ForceDotNet.Force();
_server = new ResponseSocket("@tcp://localhost:5556");
_client = new RequestSocket(">tcp://localhost:5556");
_client.SendFrame("assss");
GD.Print(_server.ReceiveFrameString());
}
public override void _Process(float delta)
{
}
public override void _Input(InputEvent @event)
{
if (@event.IsActionPressed("quit"))
{
GetTree().Quit();
}
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
NetMQConfig.Cleanup(false);
}
}
}
I will try this, thank you @KrunoSaho
Consider the following code:
On Linux this works fine with Mono On Windows this works fine with .NET But on Windows this crashes with Mono
at AsyncIO.Windows.Socket.SetSocketOption
The first response might be: Just use .NET on Windows but I am using NetMQ in the Godot game engine. When you export your "game" it bundles Mono so it always targets and not .NET.
In other words AsyncIO/NetMQ works great in Godot on Linux, not so much on Windows.