Get client's IP address and PC name in ListView

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • haanjae
    New Member
    • Mar 2011
    • 13

    Get client's IP address and PC name in ListView

    hello, i want to show the client's ip and machine name in ListView. Please help.

    i also created code the collection for the listview collection
    Code:
    class ClientCollection
        {
            
            public string userIpadd { get; set; }
            public string userPcname { get; set; }
    
            public ClientCollection()
            {
            }
        }
    the code below will only show the number that the client connected to the server.
    Code:
    // Update the list of clients that is displayed
    		void UpdateClientList()
    		{
                    listView1.Items.Clear();
    		for(int i = 0; i < m_workerSocketList.Count; i++)
    		{
    		string clientKey = Convert.ToString(i+1);
    		Socket workerSocket = (Socket)m_workerSocketList[i];
    
                    ListViewItem item = new ListViewItem();
    
    		if(workerSocket != null)
    		{
    		if(workerSocket.Connected)
    		{
                       listView1.Items.Add(clientKey);
    		}
    		}
    		}
    		}
    Please help, thanks a lot.
Working...