示例#1
0
bool CIpInfo::GetIpInfo(unsigned char* lpszDotIp,unsigned char* lpszInfoBuf,int nMaxBufSize)
{
	bool bReturn = false;
	lpszInfoBuf[0] = '\0';
	if(m_bInit)
	{
		unsigned long lHostByteOrderAddr = inet_addr((char*)lpszDotIp);
		if(lHostByteOrderAddr != INADDR_NONE)
		{
			unsigned long lNetByteOrderAddr = htonl(lHostByteOrderAddr);
			bReturn = GetIpInfo(lNetByteOrderAddr,lpszInfoBuf,nMaxBufSize);
		}
	}
	return bReturn;
}	
示例#2
0
BOOL QQwry::GetIpInfo(LPSTR lpszDotIp,LPSTR lpszInfoBuf,int nMaxBufSize)
{
	BOOL bReturn = FALSE;
	lpszInfoBuf[0] = '\0';

	if(m_bInit)
	{
		//地址转换
		ULONG lHostByteOrderAddr = inet_addr(lpszDotIp);

		if(lHostByteOrderAddr != INADDR_NONE)
		{
			ULONG lNetByteOrderAddr = htonl(lHostByteOrderAddr);
			bReturn = GetIpInfo(lNetByteOrderAddr,lpszInfoBuf,nMaxBufSize);
		}
	}

	return bReturn;
}