Example #1
0
        private void clientListBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            selectedClient          = (clientInfo)clientInformation[clientListBox.SelectedIndex];
            machineNameTextBox.Text = selectedClient.MachineName;
            userNameTextBox.Text    = selectedClient.UserName;
            ipAddressTextBox.Text   = selectedClient.IpAddress;
            portTextBox.Text        = selectedClient.PortNumber.ToString();
            protocolTextBox.Text    = selectedClient.ConnectedSocket.ProtocolType.ToString();

            if (radioButton1.Checked)
            {
                serviceListBox.Items.Clear();
                IEnumerator en = selectedClient.ProcessList.GetEnumerator();

                while (en.MoveNext())
                {
                    ProcessObject processObject = (ProcessObject)en.Current;
                    serviceListBox.Items.Add(processObject.ProcessName);
                }
            }
            else if (radioButton2.Checked)
            {
                serviceListBox.Items.Clear();
                IEnumerator en = selectedClient.ServiceList.GetEnumerator();

                while (en.MoveNext())
                {
                    ServiceObject serviceObject = (ServiceObject)en.Current;
                    serviceListBox.Items.Add(serviceObject.DisplayName);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Event handler for new client connection
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void clientConnectionHandler(object sender, serverListenerArgs e)
        {
            clientInfo c = e.ClientInfo;

            clientInformation.Add(c);
            //clientListBox.Items.Add(c.ConnectedSocket.RemoteEndPoint.ToString());


            clientListBox.Items.Add(c.MachineName);
            //c.getMachineName();
        }
Example #3
0
        ///<summary>
        /// This method is a starting point of listener thread which continously listens for new clients
        /// and when a client arrives starts a new thread to handle that client
        ///</summary>
        public void server_listen()
        {
            while (running)
            {
                try
                {
                    Socket sock = server_socket.AcceptSocket();
                    //  Console.WriteLine("Connected to Server "+sock.RemoteEndPoint);
                    clientInfo clt = new clientInfo(sock);

                    onClientSignal(this, new serverListenerArgs(clt));
                    //clt.getMachineName();
                }
                catch (Exception e)
                {
                    throw new Exception("Error Occurred while listening for clients ");
                }
            }
        }
Example #4
0
 public serverListenerArgs(clientInfo cltinfo) : base()
 {
     this.clientinfo = cltinfo;
 }