示例#1
0
        private void Listen()
        {
            AddStatus("Listener started.");

            while (true)
            {
                TcpClient client = server.AcceptTcpClient();

                AddStatus("New Client: " + n.ToString());
                AddStatus("Processing...");

                TabPage tab = new TabPage("Client " + n.ToString());
                n++;

                TcpClientControl control = new TcpClientControl();
                tab.Controls.Add(control);
                control.Disposed += OnTcpClientControlDispose;

                Invoke((Action)(() => mainTabControl.TabPages.Add(tab)));

                control.SetTcpClient(client);

                AddStatus("Done.");
            }
        }
示例#2
0
        private void Listen()
        {
            AddStatus("Listener started.");

            while (true)
            {
                TcpClient client = server.AcceptTcpClient();

                AddStatus("New Client: " + n.ToString());
                AddStatus("Processing...");

                TabPage tab = new TabPage("Client " + n.ToString());
                n++;

                TcpClientControl control = new TcpClientControl();
                tab.Controls.Add(control);
                control.Disposed += OnTcpClientControlDispose;

                Invoke((Action)(() => mainTabControl.TabPages.Add(tab)));

                control.SetTcpClient(client);

                AddStatus("Done.");
            }
        }
示例#3
0
        public ClientView(string hostname, ushort port)
        {
            InitializeComponent();

            Show();

            TcpClientControl view = new TcpClientControl();
            Controls.Add(view);

            try
            {
                TcpClient client = new TcpClient(hostname, port);
                view.SetTcpClient(client);
                view.Disposed += OnDisposed;
            }
            catch (SocketException)
            {
                MessageBox.Show("Couldn't connect.");
                Dispose();
            }
        }
示例#4
0
        public ClientView(string hostname, ushort port)
        {
            InitializeComponent();

            Show();

            TcpClientControl view = new TcpClientControl();

            Controls.Add(view);

            try
            {
                TcpClient client = new TcpClient(hostname, port);
                view.SetTcpClient(client);
                view.Disposed += OnDisposed;
            }
            catch (SocketException)
            {
                MessageBox.Show("Couldn't connect.");
                Dispose();
            }
        }