Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to set TimerTimeout for MsgSendv? : (1 Item)
   
How to set TimerTimeout for MsgSendv?  
Hi, 
I've planned to set timeouts for client MsgSendv calls by TimerTimeout: 

Code:

int CClient::Write() 
{ 
  ... 
  if ( ( fd = name_open("IOV_SVP", 0) ) == -1 )
  {
     printf("Can't find Message Server\n");
     perror("name_open");
     return (-1);
  }	

    event.sigev_notify = SIGEV_UNBLOCK;
    timeout.tv_sec  = 1;
    timeout.tv_nsec =  0;    
    timer_timeout( CLOCK_REALTIME,_NTO_TIMEOUT_SEND|_NTO_TIMEOUT_REPLY, &event, &timeout, NULL );	
    MsgSendv(fd,  send_iov, 2, reply_iov, 2 );
 
    name_close(fd);
} 


At the server side there is an endless cycle with MsgReceive. I simulate server crash by sleep function. If i want the 
clinet be REPLY blocked, i place sleep(10) before MsgReply (after MsgReceive). 

Code:
... 
intChID = ChannelCreate(_NTO_CHF_FIXED_PRIORITY);		
ptDpp=_dispatch_create(intChID, 0);
if ((attach = name_attach(ptDpp, "IOV_SVP", 0  )) == NULL) 
{
   printf("name_attach Failed");
}
.... 
while(1)
{
  ....
  rcvid = MsgReceivev( attach->chid,  recv_iov, 2, &info ) ;        	
  sleep(10); 
  MsgReplyv( rcvid,  11, reply_iov ,  2 ) ;   
  sleep(1);  
}	   

The problem is timeout doesn't work in case of REPLY blocked client!

Documentation says: 
Quote:
MsgSendv() doesn't unblock on SIGEV_UNBLOCK if the server has already received the message via MsgReceivev() and has 
specified _NTO_CHF_UNBLOCK in the flags argument to its ChannelCreate() call 

But i don't set _NTO_CHF_UNBLOCK for the channel.
Is there any method to set timeout for MsgSendv? 

Thanks