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


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

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


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

示例1: ClientDisconnected

void CJavaDebugAgentDriver::ClientDisconnected(CTcpServerHandler* aHandler)
{
    TInt handlerPos = iHandlers.Find(aHandler);
    if (handlerPos >= 0) {
        TInetAddr remote;
        RSocket* socket = aHandler->Socket();
        socket->LocalName(remote);

        // Delete a matching KeepAlive object. It doesn't matter which one.
        // Ideally we shouldn't create more than one KeepAlive per address
        // but we normally have no more than one client, so it's doesn't
        // really matter.
        for (TInt i = 0; i<iKeepAliveList.Count(); i++)
        {
            if (remote.Match(iKeepAliveList[i]->Address()))
            {
                delete iKeepAliveList[i];
                iKeepAliveList.Remove(i);
                break;
            }
        }

        // It's not obvious how we can recover from the situation when
        // we can't this handler to iDeadHandlers array. It's not safe
        // to delete the handler here because this callback is invoked 
        // by the handler, and it may access its this pointer after this
        // callback has returned. It that case, let's leave it in iHandlers
        // array. It screws things up but at least we don't leak memory.
        // Hopefully, this won't happen too often...
        if (iDeadHandlers.Append(aHandler) == KErrNone)
        {
            iHandlers.Remove(handlerPos);
            if (iHandlers.Count() == 0) {
                // It was our last client
                SetState(iServer ? EListening : EDisconnected);
            }
            // Schedule callback on a clean stack where we can safely
            // delete the handler
            iAsyncCleanup->CallBack();
        }
    }
    
    //Dima: Cleanup on start in InitL conflicts with installation
    //seemingly due to errors in Installer (ECOM framework panics
    //on loading midp2installerplugin.dll on installation after cleanup)
    //so we clean up on client disconnect.
    if (IsAutoCleanEnabled())
    {
        Log(_L("Cleaning up old data..."));
        iEngine->Cleanup();
        Log(_L("Done cleaning..."));
    }
}
开发者ID:fedor4ever,项目名称:packaging,代码行数:53,代码来源:JavaDebugAgentDriver.cpp

示例2: ClientConnected

// Notifications from CTcpServerHandler
void CJavaDebugAgentDriver::ClientConnected(CTcpServerHandler* aHandler)
{
    if (iHandlers.Append(aHandler) == KErrNone)
    {
        if (iKeepAlivePeriod > 0)
        {
            TInetAddr local;
            TInetAddr remote;
            aHandler->Socket()->LocalName(local);
            aHandler->Socket()->RemoteName(remote);

            // No ping for local connections (as in case of debugging over
            // Bluetooth)
            if (!local.Match(remote))
            {
                TRAPD(err, InitKeepAliveL(&remote));
                if (err == KErrNone)
                {
                    iLog->Log(_S("Starting keep-alive timer"));
                }
                else
                {
                    // Ignore the error, it shoudn't be fatal
                    iLog->LogFormat(_S("Keep-alive error %d"),err);
                }
            }
        }

        if (iHandlers.Count() == 1) 
        {
            // First client
            SetState(EConnected);
        }
    }
    else
    {
        // This connection will work but we will leak some memory.
        // Suggest the user to restart the application
        iLog->Log(_S("Internal error. Please restart debug agent."));
    }
}
开发者ID:fedor4ever,项目名称:packaging,代码行数:42,代码来源:JavaDebugAgentDriver.cpp

示例3: IPAddrIsEqual

//-- compares 2 IP addresses, for array search.
TBool IPAddrIsEqual(const TInetAddr& aFirst, const TInetAddr& aSecond)
    {
    return aFirst.Match(aSecond);
    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:5,代码来源:LlmnrInit.cpp


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