I need to read from an AF_UNIX socket to a buffer using the function read from C, but I don\'t know the buffer size.
read
I think the best way is to read
On common way is to use ioctl(..) to query FIONREAD of the socket which will return how much data is available.
ioctl(..)
FIONREAD
int len = 0; ioctl(sock, FIONREAD, &len); if (len > 0) { len = read(sock, buffer, len); }