怎样才能得到域名?

解决方案 »

  1.   

    得到本地主机的名称用gethostname,得到internet主机的域名向dns服务器查询
      

  2.   

    gethostname根据IP查询
    或直接用命令行nslookup查询
      

  3.   

    gethostname
    The gethostname function returns the standard host name for the local machine.int gethostname(
      char FAR *name,  
      int namelen       
    );
    Parameters
    name 
    [out] Pointer to a buffer that receives the local host name. 
    namelen 
    [in] Length of the buffer.