)
to receive incoming connections.
It prevents the application from receiving the connected descriptor via
accept()
until data arrives on the connection.
sok
.
struct accept_filter_arg afa;
bzero(&afa, sizeof(afa));
strcpy(afa.af_name, "dataready");
setsockopt(sok, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa));