Moore's Mind

Tuesday, October 18, 2005

New PNRP Functions

Windows Vista October CTP contains some new PNRP functions that remove the previous complexity of having to use the underlying WSAxxx functions. Since the Windows SDK won't be updated until Beta 2, here's a guess at what these functions probably do.

PeerPnrpGetCloudInfo - probably returns a PNRPCLOUDINFO structure. Not sure how to Enum clouds though. Equivalent to this.

PeerPnrpGetEndpoint - probably converts a peer name to an endpoint

PeerPnrpRegister, PeerPnrpUnregister - probably registers and unregisters a peer name in the serverless DNS. Equivalent to this and this.

PeerPnrpUpdateRegistration - probably allows info such as address and comment to be updated for a previously registered peer name

PeerPnrpResolve - probably determines if a peer name exists. Equivalent to this.

PeerPnrpStartResolve, PeerPnrpEndResolve - asynchronous version

1 Comments:

  • At 8:59 PM, Blogger Tripp Parks said…

    PeerPnrpGetCloudInfo: returns an array of CloudInfo's

    PeerPnrpGetEndpoint used with PeerPnrpStartResolve,PeerPnrpEndResolve

    Register

    HANDLE hRegistration;
    HRESULT hr;
    //Startup
    PeerPnrpStartup(2);
    //Register name
    hr = PeerPnrpRegister(L"0.Test", NULL, &hRegistration);
    if(SUCCEEDED(hr)){
    //Unregister the name
    PeerPnrpUnregister(hRegistration);
    }
    PeerPnrpShutdown();


    //Resolve
    HANDLE hRegistration;
    HRESULT hr;
    PEER_PNRP_ENDPOINT_INFO *pEndpoint = NULL;
    //Startup
    PeerPnrpStartup(2);
    HANDLE hEvent = CreateEvent(0, FALSE, FALSE, 0);
    hr = PeerPnrpStartResolve(L"0.ScooterPie", NULL, 5, hEvent, &hResolve);
    while(SUCCEEDED(hr)){
    if (WaitForSingleObject(hEvent, INFINITE) == WAIT_OBJECT_0)
    {
    hr = PeerPnrpGetEndpoint(hResolve, &pEndpoint);
    PeerFreeData(pEndpoint);
    }
    else
    {
    //Error ;
    }
    }
    PeerPnrpEndResolve(hResolve);
    PeerPnrpShutdown();

     

Post a Comment

<< Home