Page MenuHomeFreeBSD
Authored By
glebius
Jun 2 2022, 6:42 PM
Size
649 B
Referenced Files
None
Subscribers
None

lowat-dgram.c

#include <sys/types.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <stdio.h>
#include <err.h>
static int fd[2];
void
test(void)
{
char buf[50];
fd_set rfds;
if (send(fd[0], buf, 50, 0) != 50)
err(1, "send");
FD_ZERO(&rfds);
FD_SET(fd[1], &rfds);
if (select(fd[1] + 1, &rfds, NULL, NULL, NULL) != 1)
err(1, "select");
if (recv(fd[1], buf, 50, 0) != 50)
err(1, "receive");
}
int
main(int argc, char *argv[])
{
int v;
if (socketpair(PF_UNIX, SOCK_DGRAM, 0, fd) != 0)
err(1, "socketpair");
test();
v = 100;
if (setsockopt(fd[1], SOL_SOCKET, SO_RCVLOWAT, &v, sizeof(v)) != 0)
err(1, "setsockopt");
test();
}

File Metadata

Mime Type
text/x-c
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4812360
Default Alt Text
lowat-dgram.c (649 B)

Event Timeline