Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum length of buffer in AF_UNIX socket

Tags:

c

sockets

I would like to know: when programming in C using a socket (AF_UNIX) is there any limit (in bytes) when sending or receiving to or from a socket?

like image 895
Donovan Avatar asked Jun 16 '10 10:06

Donovan


1 Answers

You can change the read and write buffers for each individual socket connection using setsockopt (SO_SNDBUF and SO_RCVBUF).

The default and maximum sizes are platform dependent.

Furthermore, if you provide a larger user-side buffer for each individual read e.g. with recv.

And if you use several recvs in sequence, you can read an infinite amount of bytes over a connection, it'll just take infinitely long.

like image 125
Will Avatar answered Oct 17 '22 05:10

Will