Tizen 2.1 base
[platform/upstream/libnl2.git] / tests / test-socket-creation.c
1 #include "../src/utils.h"
2
3 int main(int argc, char *argv[])
4 {
5         struct nl_sock *h[1025];
6         int i;
7
8         h[0] = nl_handle_alloc();
9         printf("Created handle with port 0x%x\n",
10                         nl_socket_get_local_port(h[0]));
11         nl_handle_destroy(h[0]);
12         h[0] = nl_handle_alloc();
13         printf("Created handle with port 0x%x\n",
14                         nl_socket_get_local_port(h[0]));
15         nl_handle_destroy(h[0]);
16
17         for (i = 0; i < 1025; i++) {
18                 h[i] = nl_handle_alloc();
19                 if (h[i] == NULL)
20                         nl_perror("Unable to allocate socket");
21                 else
22                         printf("Created handle with port 0x%x\n",
23                                 nl_socket_get_local_port(h[i]));
24         }
25
26         return 0;
27 }