Click here to Skip to main content
15,907,913 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends ,

I am new in MFC programing,
I'm writing socket application in MFC using CAsynSocket, I want name of client's machine.
How i take client machine name?

Thanks in Advance.
Posted
Updated 17-Apr-11 22:59pm
v2

1 solution

http://www.google.nl/search?sourceid=chrome&ie=UTF-8&q=visual+C%2B%2B+get+computer+name[^]

C#
#include <windows.h>
int main()
{
    bool bSuccess_c=TRUE; // I added this declaration
    char cname[MAX_COMPUTERNAME_LENGTH+1];
    int lengu = MAX_COMPUTERNAME_LENGTH+1;
    if(!GetComputerName( cname, &lengu))
    {
        bSuccess_c = FALSE;
    }
    return 0;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900