Server Termination detection from within the Client Process

I have a Client Server model sending and receiving both custom messages and pulses, on the server side I am using
name_attach and MsgReceive / MsgReceivePulse, on the client side I am using name_open and MsgSend / MsgSendPulse.

I am attempting to determine if the server has terminated, I plan to use critail process monitoring to restart the
server should it be terminated.

I would is possible rather not call name_open, MsgSendPulse, name_close every time I have message.

On the client side I was hoping to do something like this:

name_open()

for(;:wink:
{

….
….
….
….

status = MsgSendPulse_r()
if(status !=EOK)
{
     if(status == EBADF)
     {
          name_open()  
     }
}

}

However MsgSendPulse_r always returns EOK, even when the server has been terminated and the entry in the namespace /dev/
name/local has been removed.

Any ideas how I can achieve this.

Regards

William

It seems that MsgSendPulse should detect the error since it’s documented to return an error if the coid is dead.

Regardless, if you do a name_open() to the server, and leave it open, a pulse will be sent to your application if the server dies (I think _PULSE_CODE_DISCONNECT but it’s in the docs).