hi, I have the problem with TimerTimeout(), it doesnt work on MsgSend()
My server creates connection, receives message and waits (I dont send reply). My client opens channel, and when time expires, nothing happened. Thread is still blocked (REPLY status).
Please could u help me with my program?
Code:
#include <sys/neutrino.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/dispatch.h>
#include <sys/siginfo.h>
…
void * vlakno5 (void *not_used) //some thread
{
int kanal;
char *upr_send, receive[256], *prefix = “~S”;
struct sigevent event;
uint64_t timeout = 1000000000;
if ((kanal = name_open(“hcs12”, NULL)) != -1)
{
printf (“client connected… \n”);
}
else
{
printf (“Error with connection…\n”);
return (0);
}
for (a = 0; a < 256; a++) receive[a] = 0;
printf (“Im sending: %s\n”, slajder);
upr_send = (char*)malloc(strlen(slajder) + 3);
strcpy(upr_send, prefix);
strcat(upr_send, slajder);
strcat(upr_send, “#”);
event.sigev_notify = SIGEV_UNBLOCK;
TimerTimeout (CLOCK_REALTIME, _NTO_TIMEOUT_REPLY, &event, &timeout, NULL);
if (MsgSend(kanal, upr_send, strlen(upr_send), receive, sizeof(receive)) == -1)
{
printf(“error with connection: %s\n”, receive);
}
else
{
printf(“receive: %s\n”, receive);
}
return EXIT_SUCCESS;
}
thx.