private void SetupServer() { ServerSocket.Bind(new IPEndPoint(IPAddress.Any, Port)); ServerSocket.Listen(0); ServerSocket.BeginAccept(AcceptCallback, null); ServerListening?.Invoke("Server listening on port " + Port); }
/// <summary> /// Start the listening server /// </summary> public void Start() { try { _listener.Start(); isWorking = true; listeningTask = Task.Run(async() => await waitingForClients()); ServerListening?.Invoke(); } catch (Exception e) { ServerListeningFailed.Invoke(e); } }
internal virtual void OnServerListening(EventArgs e) => ServerListening?.Invoke(this, e);