vde_autolink: Add missing null entry in getopt_long array.
[vde.git] / ipn / test / test1.c
blobe42a9d3f5ec823f290ef6940b94fb4cae80ebd7c
1 #include <stdio.h>
2 #include <errno.h>
3 #include <sys/types.h>
4 #include <sys/socket.h>
5 #include <sys/un.h>
6 #include <af_ipn.h>
8 char buf[256];
9 struct sockaddr_un sun={.sun_family=AF_IPN,.sun_path="/tmp/sockipn"};
10 main()
12 int s=socket(AF_IPN,SOCK_RAW,IPN_BROADCAST);
13 int err;
14 int len;
15 if (s< 0) {
16 s=socket(AF_IPN,SOCK_RAW,IPN_BROADCAST);
17 if (s< 0)
18 perror("socket");
20 printf("s=%d\n",s);
21 err=connect(s,(struct sockaddr *)&sun,sizeof(sun));
22 if (err<0)
23 perror("connect");
24 while ((len=read(s,buf,256)) > 0) {
25 write(1,buf,len);
27 if (len < 0)
28 perror("read");
29 close(s);