Beispiel #1
0
        public MJpegStreamingServer(int listenPort, string boundary)
        {
            Port = listenPort;
              Boundary = boundary;

              _server = new AsyncTcpServer(Port);
              _server.Encoding = Encoding.ASCII;
              _clients = new ConcurrentDictionary<string, TcpClient>();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            LogFactory.Assign(new ConsoleLogFactory());

              server = new AsyncTcpServer(9999);
              server.Encoding = Encoding.UTF8;
              server.ClientConnected += new EventHandler<TcpClientConnectedEventArgs>(server_ClientConnected);
              server.ClientDisconnected += new EventHandler<TcpClientDisconnectedEventArgs>(server_ClientDisconnected);
              server.PlaintextReceived += new EventHandler<TcpDatagramReceivedEventArgs<string>>(server_PlaintextReceived);
              server.Start();

              Console.WriteLine("TCP server has been started.");
              Console.WriteLine("Type something to send to client...");
              while (true)
              {
            string text = Console.ReadLine();
            server.SendToAll(text);
              }
        }