I am using pic32(C32 compiler) ,32 bit architecture for my iot module where i am receiving data from cloud than extract into my application.I am using this function (these are maximum details i can provide).First 3 values extracted successfully,after 3rd value i have a dns address like xyz.gcloudxyz.in ,here is the problem i have faced strtok_r split string at '.' peroid instead of ',' comma.
This is my src buff data
866758041000000,2,DV1,xyz.gcloudxyz.in,1111,2222,3333,DV2,xyz.gcloudxyz.in,1234,1231,1212,
void SERVERGetConf(ubyte *src,DEVICE_CONF *dst)
{
unsigned char *src_ptr = src;
unsigned char *token = 0,*rest_ptr;
unsigned char matched_string[2] = ",";
unsigned char cCount,AvlbConf = dst->avilable_config;
token = (unsigned char *) strtok_r(src_ptr,",",&rest_ptr);
if(!memcmp(token,modem.imei,sizeof(token)))
{
token = strtok_r(NULL, matched_string,&rest_ptr);
dst->avilable_config = atoi(token);
for(cCount = 0;cCount < dst->avilable_config;cCount++)
{
DATA_SERVER_CONFIG t_conf = {0};
token = strtok_r(NULL, matched_string,&rest_ptr);
memcpy(t_conf.data.id, token,sizeof(token));
token = strtok_r(NULL, matched_string,&rest_ptr); //**At this line split at '.'**
memcpy(t_conf.data.domain, token,sizeof(token));
token = strtok_r(NULL, matched_string,&rest_ptr);
memcpy(t_conf.data.port[0], token,sizeof(token));
token = strtok_r(NULL, matched_string,&rest_ptr);
memcpy(t_conf.data.port[1], token,sizeof(token));
token = strtok_r(NULL, matched_string,&rest_ptr);
memcpy(t_conf.data.port[2], token,sizeof(token));
dst->device[cCount].data = t_conf.data;
}
modem.flag.sendingconfigration = 0;
conf.flags.bits.config_updated = 1;
}
}