]> hackdaworld.org Git - my-code/ivac.git/commitdiff
udp working in principle now
authorhackbard <hackbard>
Sat, 26 Oct 2002 13:15:06 +0000 (13:15 +0000)
committerhackbard <hackbard>
Sat, 26 Oct 2002 13:15:06 +0000 (13:15 +0000)
datagram.c

index 2637fa813ce7623eecec02fd8f3b2de4d94a0633..bcee9431bcd84e2c38fbd09488057d5c99a7287b 100644 (file)
@@ -31,7 +31,7 @@
 #include <fcntl.h>
 
 int main(int argc, char *argv[]) {
-  int send_fd;
+  int send_fd,broadcast_on;
   struct sockaddr_in local_addr, remote_addr;
   socklen_t remote_addr_len,optlen;
   int send_bytes, read_bytes;
@@ -47,8 +47,9 @@ int main(int argc, char *argv[]) {
     exit(1);
   }
 
-  optlen=1;
-  if((setsockopt(send_fd,SOL_SOCKET,SO_BROADCAST,NULL,optlen))==-1)
+  broadcast_on=1;
+  optlen=sizeof(broadcast_on);
+  if((setsockopt(send_fd,SOL_SOCKET,SO_BROADCAST,&broadcast_on,optlen))==-1)
     perror("setsockopt");