当前位置: 首页>>代码示例>>C++>>正文


C++ LLHost::getHostName方法代码示例

本文整理汇总了C++中LLHost::getHostName方法的典型用法代码示例。如果您正苦于以下问题:C++ LLHost::getHostName方法的具体用法?C++ LLHost::getHostName怎么用?C++ LLHost::getHostName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LLHost的用法示例。


在下文中一共展示了LLHost::getHostName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ensure

void host_object::test<9>()
{
    std::string hostStr = "google.com";
    LLHost host;
    host.setHostByName(hostStr);

    // reverse DNS will likely result in appending of some
    // sub-domain to the main hostname. so look for
    // the main domain name and not do the exact compare

    std::string hostname = host.getHostName();
    ensure("getHostName failed", hostname.find(hostStr) != std::string::npos);
}
开发者ID:Tjarko-Holtjer,项目名称:rainbow,代码行数:13,代码来源:llhost_tut.cpp

示例2: skip

	void host_object::test<9>()
	{
		skip("this test is irreparably flaky");
//		skip("setHostByName(\"google.com\"); getHostName() -> (e.g.) \"yx-in-f100.1e100.net\"");
		// nat: is it reasonable to expect LLHost::getHostName() to echo
		// back something resembling the string passed to setHostByName()?
		//
		// If that's not even reasonable, would a round trip in the /other/
		// direction make more sense? (Call getHostName() for something with
		// known IP address; call setHostByName(); verify IP address)
		//
		// Failing that... is there a plausible way to test getHostName() and
		// setHostByName()? Hopefully without putting up a dummy local DNS
		// server?

		// monty: If you don't control the DNS server or the DNS configuration
		// for the test point then, no, none of these will necessarily be
		// reliable and may start to fail at any time. Forward translation
		// is subject to CNAME records and round-robin address assignment.
		// Reverse lookup is 1-to-many and is more and more likely to have
		// nothing to do with the forward translation.
		// 
		// So the test is increasingly meaningless on a real network.

		std::string hostStr = "lindenlab.com";
		LLHost host;
		host.setHostByName(hostStr);

		// reverse DNS will likely result in appending of some
		// sub-domain to the main hostname. so look for
		// the main domain name and not do the exact compare
		
		std::string hostname = host.getHostName();
		try
		{
			ensure("getHostName failed", hostname.find(hostStr) != std::string::npos);
		}
		catch (const std::exception&)
		{
			std::cerr << "set '" << hostStr << "'; reported '" << hostname << "'" << std::endl;
			throw;
		}
	}
开发者ID:Belxjander,项目名称:Kirito,代码行数:43,代码来源:llhost_test.cpp

示例3:

	void host_object::test<9>()
	{
//		skip("setHostByName(\"google.com\"); getHostName() -> (e.g.) \"yx-in-f100.1e100.net\"");
		std::string hostStr = "linux.org";		
		LLHost host;
		host.setHostByName(hostStr);	

		// reverse DNS will likely result in appending of some
		// sub-domain to the main hostname. so look for
		// the main domain name and not do the exact compare
		
		std::string hostname = host.getHostName();
		try
		{
			ensure("getHostName failed", hostname.find(hostStr) != std::string::npos);
		}
		catch (const std::exception&)
		{
			std::cerr << "set '" << hostStr << "'; reported '" << hostname << "'" << std::endl;
			throw;
		}
	}
开发者ID:Xara,项目名称:Opensource-V2-SL-Viewer,代码行数:22,代码来源:llhost_test.cpp


注:本文中的LLHost::getHostName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。