chrdev persistence + ioctl renumbering (following the IOR/IOW scheme)
[vde.git] / ipn / test / test0x.c
blob6494dead062c3b3a42abb90dcea040fb1b8f3e53
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 #define LIMIT 10000
9 char buf[256];
10 struct sockaddr_un sun={.sun_family=AF_IPN,.sun_path="/tmp/sockipn"};
11 main()
13 int s=socket(AF_IPN,SOCK_RAW,IPN_BROADCAST);
14 int err;
15 int len;
16 int i;
17 if (s< 0)
18 perror("socket");
19 printf("s=%d\n",s);
20 err=bind(s,(struct sockaddr *)&sun,sizeof(sun));
21 if (err<0)
22 perror("bind");
23 err=connect(s,NULL,0);
24 if (err<0)
25 perror("connect");
26 for (i=0;i<LIMIT;i++) {
27 sprintf(buf,"%d\n",i);
28 err=write(s,buf,256);
29 if (err<0)
30 perror("write sock");
32 if (len < 0)
33 perror("read stdin");
34 close(s);