socket.io-client-csharp
socket.io-client-csharp copied to clipboard
PlatformNotSupportedException
hello, i'm using .NET 6.0 on Windows 10, when i call this function
private async void Form1_Load(object sender, EventArgs e)
{
socketConnectionChanged(false);
socketio= new SocketIO("http://192.168.0.107:5000");
socketio.OnConnected += async (sender, e) =>
{
socketConnectionChanged(true);
};
socketio.OnDisconnected += async (sender, e) =>
{
socketConnectionChanged(false);
};
await socketio.ConnectAsync();
in the following line
await socketio.ConnectAsync();
i get this error
System.PlatformNotSupportedException: 'Operation is not supported on this platform.'
this is the details
System.PlatformNotSupportedException
HResult=0x80131539
Message=Operation is not supported on this platform.
Source=System.Private.CoreLib
StackTrace:
at System.Action`1.BeginInvoke(T obj, AsyncCallback callback, Object object)
at WebSocketSharp.WebSocket.open()
at WebSocketSharp.WebSocket.Connect()
at SocketIOClient.NetFx.WebSocketClient.WebSocketSharpClient.<ConnectAsync>d__10.MoveNext()
at SocketIOClient.SocketIO.<ConnectCoreAsync>d__88.MoveNext()
at SocketIOClient.SocketIO.<ConnectAsync>d__87.MoveNext()
at HeatFusion.Form1.<Form1_Load>d__5.MoveNext() in C:\Users\Hedi\source\repos\HeatFusion\HeatFusion\Form1.cs:line 209
i'm a python/flutter/javascript developer, i recently went into C# so i honestly have no idea what's going on, i'd appreciate some help on this.
i did some more test, when the socketio server is offline, i get the following error instead
SocketIOClient.Exceptions.ConnectException: 'Timeout, please see innerException.'
inner exception:
WebSocketException: Unable to connect to the remote server.
use .net framework or .net standard