浏览代码

getsockopt

Jiri Kuthan 23 年之前
父节点
当前提交
76955749a9
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      test/udp.c

+ 9 - 0
test/udp.c

@@ -61,6 +61,8 @@ bouquets and brickbats to [email protected]
 #include <arpa/inet.h>
 #include <sys/poll.h>
 
+#include <errno.h>
+
 /* this is the main function with the loops and modes */
 void shoot()
 {
@@ -76,6 +78,7 @@ void shoot()
 	fd_set	fd;
 	socklen_t slen;
 	regex_t redexp, proexp, okexp, tmhexp, errexp;
+	int bsd_compat, opt_size;
 
 	int nretries=3;
 	char *buff="MiniTest";
@@ -125,6 +128,12 @@ void shoot()
 	}
 #endif
 
+	if (getsockopt( sock, SOL_SOCKET, SO_BSDCOMPAT, &bsd_compat, &opt_size )==-1) {
+		perror("ERROR");
+		exit(1);
+	}
+	printf("BSD compat: %d\n", bsd_compat);
+
 	/* here we go for the number of nretries which healily depends on the 
 	   mode */
 	for (i = 0; i <= nretries; i++)