Beispiel #1
0
 /// <summary>Raises a new RemoteSessionStarted Event.</summary>
 internal void RaiseSessionStarted(SessionStartedEventArgs e)
 {
     if (RemoteSessionStarted != null)
     {
         RemoteSessionStarted(null, e);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Thread which listens for remotely connected clients.
 /// </summary>
 private void ListenForClients()
 {
     started = true;
     TcpListener tcpListener = new TcpListener(IPAddress.Any,_port); //TODO: Add support for specified IP addresses.
     tcpListener.Start();
     while (true)
     {
         //Blocks the thread until a client had connected.
         TcpClient RemoteTcpClient = tcpListener.AcceptTcpClient();
         //new TcpClient() { Client = tcpListener.Server.Accept(); };
         SessionStartedEventArgs e = new SessionStartedEventArgs((IPEndPoint)RemoteTcpClient.Client.RemoteEndPoint,RemoteTcpClient);
         MinecraftBot.Events.RaiseSessionStarted(e);
         //Create a thread to handle communication with the connected remote client.
         RemoteClient client = new RemoteClient();
         Thread clientThread = new Thread(delegate() { client.Start(RemoteTcpClient,this); } );
         clientThread.Start();
         Clients.Add(client);
     }
 }
Beispiel #3
0
 static void RemoteSessionStarted(object sender, SessionStartedEventArgs e)
 {
     Console.ForegroundColor = ConsoleColor.Yellow;
     Console.WriteLine("Session started with {0}",e.RemoteEndPoint);
     Console.ResetColor();
 }
Beispiel #4
0
 /// <summary>Raises a new RemoteSessionStarted Event.</summary>
 internal void RaiseSessionStarted(SessionStartedEventArgs e)
 {
     if(RemoteSessionStarted != null) RemoteSessionStarted(null, e);
 }