NetCoreServer icon indicating copy to clipboard operation
NetCoreServer copied to clipboard

WPF/UWP/Windows

Open jedimaster365 opened this issue 5 years ago • 1 comments

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!

jedimaster365 avatar Apr 11 '20 18:04 jedimaster365

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!

boexler avatar Jul 09 '20 08:07 boexler