예제 #1
0
 private void SetupServer()
 {
     ServerSocket.Bind(new IPEndPoint(IPAddress.Any, Port));
     ServerSocket.Listen(0);
     ServerSocket.BeginAccept(AcceptCallback, null);
     ServerListening?.Invoke("Server listening on port " + Port);
 }
예제 #2
0
 /// <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);
     }
 }
예제 #3
0
 internal virtual void OnServerListening(EventArgs e) => ServerListening?.Invoke(this, e);