[C Linux sockets] recv() gives messy result
I want to use socket programming (bluetooth) to receive NMEA data from my GPS receiver.
On channel 1 is the serial Port service.
When I use the rfcomm program available on linux and connect the bluetooth device to a specific device file /dev/rfcomm1 I receive clear data
rfcomm connect /dev/rfcomm1 <btaddr>
But when I use a simple recv() call in a while loop.
I get a more messy result
bytes_recv = recv(sock, &buf, sizeof(buf), 0);
Does anyone knows how this is possible and how to fix it.
Of course it's possible because the rfcomm program can do it.