chronoxor / NetCoreServer

Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
https://chronoxor.github.io/NetCoreServer
MIT License
2.76k stars 575 forks source link

WPF/UWP/Windows #56

Open jedimaster365 opened 4 years ago

jedimaster365 commented 4 years ago

Hello! I tried your app and it seems to be exact what I need. However, despite all your numerous examples, I can't seem to find one which uses WPF or UWP etc... I wanted to know how to Start the server, check if the server is running and how to reconnect the server if it's down, check if the server got disconnected.

I know all these are in your examples but they all use the console. I am no expert into make use of those examples with a normal WPF app which would require, for e.g. an override of the OnConnected, OnDisconnected, OnReceived and OnError methods.

Could you please provide an example of the above functions and how to call them from my app? for e.g. int port = 1111; var server = new ChatServer(IPAddress.Any, port); server.OnError += ServerOnError; txtServerStatus.Text = "Starting server..."; server.Start(); txtServerStatus.Text = "Done!";

void OnError(SocketError error) { txtServerStatus.Text = "Server caught an error with code {error}"; } Thank you for helping out!

djonasdev commented 4 years ago

System.Net.Sockets is not supported in uwp

So you cannot use this library there (see: https://docs.microsoft.com/de-de/windows/uwp/networking/sockets)

Hopefully it will be available in future!