C - msgrcv adds characters to message received, very strange -
so msgrcv()
function call works great, adds on characters received other process.
where sender process sends hello, receiver process receives hello@\n or hello\n@ or hello@,because prints different things randomly, hard cheat fix character pruning.
code:
if (msgrcv(clientqueueid, &msg, sizeof(msg.data), 0, 0) == -1) { // no message received client } else { .........
in case, printing msg.data shows has characters attached.
this how i'm printing:
printf("received message length %d: '%s'\n", (int)strlen(msg.data), msg.data);
anyone have ideas why happening?
i knew strange issue...turns out it's problem client. had simple little function scanned '\n' , replaced '\0' "remove" new line wouldn't sent.
anyway, solution not remove new line client. somehow server reading correctly now, new line , all. hope helps down line.
Comments
Post a Comment