Unable to use ConnectAttach() and name_attach() together

Hello,

In my main process, I used ConnectAttach() to connect to a server process, and then I use name_attach() to connect to a photon gui (which uses name_open()). The problem is that after using ConnectAttach() and name_attach in my main process, the photon gui name_open() always fails.

What is going on? Please help. Thank you.


#define ATTACH_POINT “testingAttachPoint”
name_attach_t = *attach;

/*main process */
//Attach to a qnx server
coid = ConnectAttach(0, pid, chid,0,0);

//Start gui
spawnl(P_NOWAIT, GuiPathName, GuiPathName, &argv, NULL);

if(attach = name_attach(NULL, ATTACH_POINT, 0))==NULL)
{ printf(“error attaching\n”);
return (-1);
}

/* Photon GUI start-up function */
int fd;

if((fd = name_open(ATTACH_POINT,0))==-1)
{ printf (“error name_open\n”);
}

shouldnt u call name_attach before calling spawn?