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


C++ TInetAddr::ConvertToV4方法代码示例

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


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

示例1: ConnectionAcceptedL

// -----------------------------------------------------------------------------
// CUpnpHttpServer::ConnectionAcceptedL
//
// -----------------------------------------------------------------------------
//
CUpnpTcpSession* CUpnpHttpServer::ConnectionAcceptedL( RSocket aSocket )
    {
    LOG_FUNC_NAME;

    #ifdef _DEBUG
    TInetAddr tempAddr;
    aSocket.RemoteName( tempAddr );
    tempAddr.ConvertToV4();

    const TInt KMaxAdressLength = 20;
    TBuf<KMaxAdressLength> addrBuf;
    tempAddr.Output( addrBuf );

    HBufC8* addrBuf8 = UpnpString::FromUnicodeL( addrBuf );
    CleanupStack::PushL( addrBuf8 );

    LOGS( "CUpnpHttpServer::ConnectionAcceptedL - Remote socket connected" );
    LOGT( addrBuf8->Des() );

    LOGS1("CUpnpHttpServer::ConnectionAcceptedL - Creating a new Http session. Session count: %i", iSessionList.Count());

    CleanupStack::PopAndDestroy(addrBuf8);
    #endif //_DEBUG
    CUpnpHttpSession* sess = CUpnpHttpSession::NewL( aSocket, this,
        CUpnpHttpMessage::NewSessionIdL(), EPriorityNormal );

    return sess;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:33,代码来源:upnphttpserver.cpp

示例2:

enum TVerdict CEsockTest19_6::easyTestStepL()
	{
	TInetAddr addr;
	TBuf<39> buf;
	
	// convert to V4
	
	// set address to IPv6 unspecified address
	addr.Input(_L("::"));
	
	// convert to IPv4 format
	addr.ConvertToV4();
	addr.OutputWithScope(buf);
	
	// check address has been reformatted correctly
	addr.OutputWithScope(buf);
	TESTL(buf==_L("0.0.0.0"));
	
	// change address to IPv4 compatible address
	addr.Input(_L("::199.12.255.21"));
	
	// convert to IPv4 format
	addr.ConvertToV4();
	
	// check address has been reformatted correctly
	addr.OutputWithScope(buf);
	TESTL(buf==_L("199.12.255.21"));
	
	// change address to IPv4 mapped address
	addr.Input(_L("::FFFF:149.124.223.12"));
	
	// convert to IPv4 format
	addr.ConvertToV4();
	
	// check address has been reformatted correctly
	addr.OutputWithScope(buf);
	TESTL(buf==_L("149.124.223.12"));
	
	return EPass;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:40,代码来源:EsockTestSection19.cpp

示例3: CheckAndSetAddr

// -----------------------------------------------------------------------------
// CLocalAddrResolver::CheckAndSetAddr
// -----------------------------------------------------------------------------
//
void CLocalAddrResolver::CheckAndSetAddr( TInetAddr& aTarget,
                                          TInetAddr& aCandidate,
                                          TUint32 aCandidateIap,
				                          TUint32 aSpecifiedIap )
    {
    if ( !aCandidate.IsUnspecified() && !aCandidate.IsLoopback() )
        {
        if ( aCandidate.IsV4Mapped())
            {
            aCandidate.ConvertToV4();
            }
        if ( aCandidateIap == aSpecifiedIap )
            {
            SetAddr( aTarget, aCandidate );
            }
        }
    }				                          
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:21,代码来源:localaddrresolver.cpp


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