On Sun, 28 Jan 2007, Daniel Cid wrote:
> I have been trying to increase the maximum allowed size for a message
> when
> using unix domain sockets without any success...
>
> Whenever I send anything
> larger than 2048, it fails with EMSGSIZE. I looked
> at multiple sysctls and no
> one seems to be related to unix domain sockets. From
> getsockopt the maximum
> sizes should be 9k for recv and 40k for sending...
>
> To show my point, I
> created a small program that creates a server/client socket
> and attempts to
> send data between them. Whenever I reach 2049, it fails with
> "message too
> long"...
>
> Test output:
> http://pastebin.com/870008
>
> Sample code example:
> http://pastebin.com/870005
>
>
> *I am using OpenBSD 3.9 Generic..
> *Sorry for
> using pastebin, but this new yahoo mail is terrible to paste stuff...
>
> Thanks,
> Daniel
If I add this to your main() I can send larger messages:
int len;
socklen_t optlen = sizeof(len);
...
len = 4096;
if (setsockopt(c_socket, SOL_SOCKET, SO_SNDBUF, &len, optlen) == -1)
err(1, "setsockopt");
if (getsockopt(c_socket, SOL_SOCKET, SO_SNDBUF, &len, &optlen) == -1)
err(1, "getsockopt");
printf("len is %d\n", len);
Note that you have to set the buffer size of the connected socket.
-Otto