hi,
I have prob. while sending and receiving.
I want that my client will always ready for receiving and sending the msg.
my code is.
while(1)
{
ret = SP_receive( Mbox, &service_type, sender, 100, &num_groups, target_groups,
&mess_type, &endian_mismatch, sizeof(mess), mess );
printf("sender==%s\n",sender);
printf("ret===%d\n",ret);
printf("received msg= %s\n",mess);
memset(mess,'\0',sizeof(mess));
/**********************************************send*****************************************/
fp=fopen("s_group.txt","r");
while(fgets(command,120,fp))
printf("%s",command);
num_groups = sscanf(&command[0],"%s%s%s%s%s%s%s%s%s%s",groups[0],groups[1],groups[2],groups[3],groups[4],
group[5],group[6],group[7],group[8],group[9]);
printf("num_groups = %d",num_groups);
// memset(command,0,sizeof(command));
if( num_groups < 1 )
{
printf(" invalid group \n");
}
printf("enter message: ");
ret = (int) fgets( mess, 200, stdin );
mess_len = strlen( mess );
ret= SP_multigroup_multicast( Mbox, SAFE_MESS, num_groups, (const char (*)[MAX_GROUP_NAME]) groups, 1, mess_len, mess );
printf("Mbox=%d\n",Mbox);
// memset(mess ,0 ,sizeof(mess));
// printf("ret in multicast%d",ret);
if( ret < 0 )
{
SP_error( ret );
}
Num_sent++;
// printf("mess after send =%s",mess);
}
SP_leave(Mbox,group);
SP_disconnect(Mbox);
}