From e2a30f70596dbfa4fe9d16f7d57602644bcefbd5 Mon Sep 17 00:00:00 2001 From: hackbard Date: Sat, 26 Oct 2002 13:15:06 +0000 Subject: [PATCH] udp working in principle now --- datagram.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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"); -- 2.39.2