TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
haan jae
NA
22
27.5k
How to get the connected client's machine name in C#?
Nov 28 2011 10:07 AM
hello, i had been searching and trying many codes, but all the code return the local machine name, not the connected client machine name. how to get the
client machine name
??
Please help, thanks a lot.
here is the code:
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 result = new ListViewItem();
string clientinfo = Dns.GetHostName();
IPHostEntry he = Dns.GetHostEntry(clientinfo);
string sIP = (workerSocket.RemoteEndPoint.ToString().Split(':'))[0];
IPAddress tempIP = IPAddress.Parse(sIP);
if(workerSocket != null)
{
if(workerSocket.Connected)
{
result.SubItems.Add(he.HostName);
result.SubItems.Add(tempIP.ToString());
listView1.Items.Add(clientKey);
listView1.Items.Add(result);
}
}
}
}
Reply
Answers (
5
)
Convert a UTP to video converter
Way of calling method