SendMsg(ipcServ, TestTargetID, data, strlen(data)+1);
SendMsg(ipcServ, kTestTargetID, data, strlen(data)+1);
int main(int argc, char **argv){    nsresult rv;    {        nsCOMPtr<nsIServiceManager> servMan;        NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull);        nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan);        NS_ASSERTION(registrar, "Null nsIComponentRegistrar");        if (registrar)            registrar->AutoRegister(nsnull);        // Create the Event Queue for this thread...        nsCOMPtr<nsIEventQueueService> eqs =                 do_GetService(kEventQueueServiceCID, &rv);        RETURN_IF_FAILED(rv, "do_GetService(EventQueueService)");        rv = eqs->CreateMonitoredThreadEventQueue();        RETURN_IF_FAILED(rv, "CreateMonitoredThreadEventQueue");        rv = eqs->GetThreadEventQueue(NS_CURRENT_THREAD, &gEventQ);        RETURN_IF_FAILED(rv, "GetThreadEventQueue");        if (argc > 1) {            printf("*** using client name [%s]\n", argv[1]);            nsCOMPtr<nsIPrefService> prefserv(do_GetService(NS_PREFSERVICE_CONTRACTID));            if (prefserv) {                nsCOMPtr<nsIPrefBranch> prefbranch;                prefserv->GetBranch(nsnull, getter_AddRefs(prefbranch));                if (prefbranch)                    prefbranch->SetCharPref("ipc.client-name", argv[1]);            }        }        nsCOMPtr<ipcIService> ipcServ(do_GetService("@mozilla.org/ipc/service;1", &rv));        RETURN_IF_FAILED(rv, "do_GetService(ipcServ)");        NS_ADDREF(gIpcServ = ipcServ);        ipcServ->SetMessageObserver(TestTargetID, new myIpcMessageObserver());        const char *data =                "01 this is a really long message.\n"                "02 this is a really long message.\n"                "03 this is a really long message.\n"                "04 this is a really long message.\n"                "05 this is a really long message.\n"                "06 this is a really long message.\n"                "07 this is a really long message.\n"                "08 this is a really long message.\n"                "09 this is a really long message.\n"                "10 this is a really long message.\n"                "11 this is a really long message.\n"                "12 this is a really long message.\n"                "13 this is a really long message.\n"                "14 this is a really long message.\n"                "15 this is a really long message.\n"                "16 this is a really long message.\n"                "17 this is a really long message.\n"                "18 this is a really long message.\n"                "19 this is a really long message.\n"                "20 this is a really long message.\n"                "21 this is a really long message.\n"                "22 this is a really long message.\n"                "23 this is a really long message.\n"                "24 this is a really long message.\n"                "25 this is a really long message.\n"                "26 this is a really long message.\n"                "27 this is a really long message.\n"                "28 this is a really long message.\n"                "29 this is a really long message.\n"                "30 this is a really long message.\n"                "31 this is a really long message.\n"                "32 this is a really long message.\n"                "33 this is a really long message.\n"                "34 this is a really long message.\n"                "35 this is a really long message.\n"                "36 this is a really long message.\n"                "37 this is a really long message.\n"                "38 this is a really long message.\n"                "39 this is a really long message.\n"                "40 this is a really long message.\n"                "41 this is a really long message.\n"                "42 this is a really long message.\n"                "43 this is a really long message.\n"                "44 this is a really long message.\n"                "45 this is a really long message.\n"                "46 this is a really long message.\n"                "47 this is a really long message.\n"                "48 this is a really long message.\n"                "49 this is a really long message.\n"                "50 this is a really long message.\n"                "51 this is a really long message.\n"                "52 this is a really long message.\n"                "53 this is a really long message.\n"                "54 this is a really long message.\n"                "55 this is a really long message.\n"                "56 this is a really long message.\n"                "57 this is a really long message.\n"                "58 this is a really long message.\n"                "59 this is a really long message.\n"                "60 this is a really long message.\n";        SendMsg(ipcServ, TestTargetID, data, strlen(data)+1);        PRUint32 reqToken;        nsCOMPtr<ipcIClientObserver> obs(new myIpcClientObserver());        ipcServ->QueryClientByName(NS_LITERAL_CSTRING("foopy"), obs, &reqToken);        while (gKeepRunning)            gEventQ->ProcessPendingEvents();        NS_RELEASE(gIpcServ);        printf("*** processing remaining events\n");        // process any remaining events        PLEvent *ev;        while (NS_SUCCEEDED(gEventQ->GetEvent(&ev)) && ev)            gEventQ->HandleEvent(ev);        printf("*** done\n");    } // this scopes the nsCOMPtrs    // no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM    rv = NS_ShutdownXPCOM(nsnull);    NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");    return 0;}