summaryrefslogtreecommitdiffstats
path: root/man2/recvmmsg.2
diff options
context:
space:
mode:
Diffstat (limited to 'man2/recvmmsg.2')
-rw-r--r--man2/recvmmsg.214
1 files changed, 7 insertions, 7 deletions
diff --git a/man2/recvmmsg.2 b/man2/recvmmsg.2
index b1d9f2a28..1cd76e526 100644
--- a/man2/recvmmsg.2
+++ b/man2/recvmmsg.2
@@ -213,7 +213,7 @@ can give the following output:
#include <string.h>
#include <sys/socket.h>
#include <time.h>
-
+\&
int
main(void)
{
@@ -226,13 +226,13 @@ main(void)
struct mmsghdr msgs[VLEN];
struct timespec timeout;
struct sockaddr_in addr;
-
+\&
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd == \-1) {
perror("socket()");
exit(EXIT_FAILURE);
}
-
+\&
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
addr.sin_port = htons(1234);
@@ -240,7 +240,7 @@ main(void)
perror("bind()");
exit(EXIT_FAILURE);
}
-
+\&
memset(msgs, 0, sizeof(msgs));
for (size_t i = 0; i < VLEN; i++) {
iovecs[i].iov_base = bufs[i];
@@ -248,16 +248,16 @@ main(void)
msgs[i].msg_hdr.msg_iov = &iovecs[i];
msgs[i].msg_hdr.msg_iovlen = 1;
}
-
+\&
timeout.tv_sec = TIMEOUT;
timeout.tv_nsec = 0;
-
+\&
retval = recvmmsg(sockfd, msgs, VLEN, 0, &timeout);
if (retval == \-1) {
perror("recvmmsg()");
exit(EXIT_FAILURE);
}
-
+\&
printf("%d messages received\en", retval);
for (size_t i = 0; i < retval; i++) {
bufs[i][msgs[i].msg_len] = 0;