多谢。

解决方案 »

  1.   

    BOOL GetPeerName( CString& rPeerAddress, UINT& rPeerPort );
    获得client的地址。然后用api函数
    struct HOSTENT FAR * gethostbyaddr(
      const char FAR *addr,  
      int len,                
      int type)将获得的地址做参数,得到一个HOSTENT结构的值,其中包括由计算机名。你可以再查查MSDN
      

  2.   

    // Get client IP address and port
    CString strPeerAddr;
    UINT nPeerPort;
    pSocket->GetPeerName(strPeerAddr,nPeerPort);
      

  3.   

    BOOL GetPeerName( CString& rPeerAddress, UINT& rPeerPort );
    获得client的地址。然后用api函数
    struct HOSTENT FAR * gethostbyaddr(
      const char FAR *addr,  
      int len,                
      int type)将获得的地址做参数,得到一个HOSTENT结构的值,其中包括由计算机名。你可以这样写