]> hackdaworld.org Git - my-code/ivac.git/commitdiff
udp buggy!
authorhackbard <hackbard>
Sat, 19 Oct 2002 02:08:09 +0000 (02:08 +0000)
committerhackbard <hackbard>
Sat, 19 Oct 2002 02:08:09 +0000 (02:08 +0000)
Makefile
datagram.c

index 8076296e97b5ac3f9137e9ca26e4d2d661797baf..0924a8b7d5c84b01b2de45c484a1847f2844ead4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 
 INCLUDEDIR = /usr/include
 
-CFLAGS = -O3 -Wall
+CFLAGS = -DDEBUG -O3 -Wall
 
 OBJS = stream receive datagram dgramrcv
 
index c2884829bdff40f2011558c70993670e24f3450f..2637fa813ce7623eecec02fd8f3b2de4d94a0633 100644 (file)
@@ -48,7 +48,9 @@ int main(int argc, char *argv[]) {
   }
 
   optlen=1;
-  setsockopt(send_fd,SOL_SOCKET,SO_BROADCAST,NULL,optlen);
+  if((setsockopt(send_fd,SOL_SOCKET,SO_BROADCAST,NULL,optlen))==-1)
+    perror("setsockopt");
+  
  
   memset(&local_addr,0,sizeof(local_addr));
   local_addr.sin_family=AF_INET;
@@ -78,6 +80,10 @@ int main(int argc, char *argv[]) {
     unsigned char buf[1000];
     read_bytes=read(0,buf,sizeof(buf));
     send_bytes=sendto(send_fd,buf,read_bytes,0,(struct sockaddr *)&remote_addr,remote_addr_len);
+#ifdef DEBUG
+    perror("sendto");
+#endif
+     
     fwrite(buf,read_bytes,1,cmd_fd);
   }