예제 #1
0
    bool ProtocolModuleTaiga::CreateUdpConnection(const char *address, int port)
    {
        loginWorker_.SetConnectionState(ProtocolUtilities::Connection::STATE_INIT_UDP);

        if ( networkManager_->ConnectTo(address, port) )
        {
            loginWorker_.SetConnectionState(ProtocolUtilities::Connection::STATE_CONNECTED);
            connected_ = true;

            // Send event indicating a succesfull connection.
            ProtocolUtilities::AuthenticationEventData auth_data(authenticationType_);
            if (identityUrl_ != "" && hostUrl_ != "")
            {
                auth_data.SetIdentity(identityUrl_);
                auth_data.SetHost(hostUrl_);
                auth_data.inventorySkeleton = GetClientParameters().inventory.get();
            }
            eventManager_->SendEvent(networkStateEventCategory_, ProtocolUtilities::Events::EVENT_SERVER_CONNECTED, &auth_data);
            
            // Request capabilities from the server.
            Thread thread(boost::bind(&ProtocolModuleTaiga::RequestCapabilities, this, GetClientParameters().seedCapabilities));
            return true;
        }
        else
        {
            LogError("Network Manager could not establish UDP connection");
            return false;
        }
    }
예제 #2
0
bool ProtocolModuleOpenSim::CreateUdpConnection(const char *address, int port)
{
    loginWorker_.SetConnectionState(ProtocolUtilities::Connection::STATE_INIT_UDP);

    if (networkManager_->ConnectTo(address, port))
    {
        loginWorker_.SetConnectionState(ProtocolUtilities::Connection::STATE_CONNECTED);
        connected_ = true;

        // Send event indicating a succesfull connection
        ProtocolUtilities::AuthenticationEventData auth_data(authenticationType_, "", loginWorker_.GetClientParameters().gridUrl);
        eventManager_->SendEvent(networkStateEventCategory_, ProtocolUtilities::Events::EVENT_SERVER_CONNECTED, &auth_data);

        // Request capabilities from the server.
        Thread thread(boost::bind(&ProtocolModuleOpenSim::RequestCapabilities, this, GetClientParameters().seedCapabilities));
        return true;
    }
    else
    {
        LogError("Network Manager could not establish UDP connection");
        return false;
    }
}