From: hackbard Date: Sat, 26 Oct 2002 13:15:06 +0000 (+0000) Subject: udp working in principle now X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2a30f70596dbfa4fe9d16f7d57602644bcefbd5;p=my-code%2Fivac.git udp working in principle now --- diff --git a/datagram.c b/datagram.c index 2637fa8..bcee943 100644 --- a/datagram.c +++ b/datagram.c @@ -31,7 +31,7 @@ #include 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");