コード例 #1
0
ファイル: BotEvents.cs プロジェクト: citsan2/LibClassicBot
 /// <summary>Raises a new RemoteSessionStarted Event.</summary>
 internal void RaiseSessionStarted(SessionStartedEventArgs e)
 {
     if (RemoteSessionStarted != null)
     {
         RemoteSessionStarted(null, e);
     }
 }
コード例 #2
0
ファイル: Server.cs プロジェクト: Grivaryg/LibClassicBot
 /// <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);
     }
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: Grivaryg/LibClassicBot
 static void RemoteSessionStarted(object sender, SessionStartedEventArgs e)
 {
     Console.ForegroundColor = ConsoleColor.Yellow;
     Console.WriteLine("Session started with {0}",e.RemoteEndPoint);
     Console.ResetColor();
 }
コード例 #4
0
ファイル: BotEvents.cs プロジェクト: Grivaryg/LibClassicBot
 /// <summary>Raises a new RemoteSessionStarted Event.</summary>
 internal void RaiseSessionStarted(SessionStartedEventArgs e)
 {
     if(RemoteSessionStarted != null) RemoteSessionStarted(null, e);
 }