1socket_broadcast(3) Library Functions Manual socket_broadcast(3)
2
3
4
6 socket_broadcast - set UDP socket to broadcast mode
7
9 #include <socket.h>
10
11 int socket_broadcast(int s);
12
14 socket_broadcast sets UDP socket s to broadcast mode. socket_send4 and
15 socket_send6 will fail to send packets to the broadcast address unless
16 socket_broadcast is called before.
17
18 Normally socket_broadcast returns 0.
19
20 If anything goes wrong, socket_broadcast returns -1, setting errno
21 appropriately.
22
23
25 #include <socket.h>
26
27 int s;
28
29 if ((s=socket_udp6())==-1)
30 strerr_die2sys(111,FATAL,"unable to create UDP socket: ");
31 if (socket_broadcast(s) == -1)
32 strerr_die2sys(111,FATAL,"unable to set broadcast mode: ");
33
34
36 socket_send4(3), socket_send6(3)
37
38
39
40 socket_broadcast(3)