commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r4205 - gnuradio/branches/developers/eb/gige


From: eb
Subject: [Commit-gnuradio] r4205 - gnuradio/branches/developers/eb/gige
Date: Sat, 30 Dec 2006 08:41:22 -0700 (MST)

Author: eb
Date: 2006-12-30 08:41:21 -0700 (Sat, 30 Dec 2006)
New Revision: 4205

Added:
   gnuradio/branches/developers/eb/gige/Makefile
   gnuradio/branches/developers/eb/gige/tx-udp.cc
Modified:
   gnuradio/branches/developers/eb/gige/
Log:
work-in-progress


Property changes on: gnuradio/branches/developers/eb/gige
___________________________________________________________________
Name: svn:ignore
   + tx-udp


Added: gnuradio/branches/developers/eb/gige/Makefile
===================================================================
--- gnuradio/branches/developers/eb/gige/Makefile                               
(rev 0)
+++ gnuradio/branches/developers/eb/gige/Makefile       2006-12-30 15:41:21 UTC 
(rev 4205)
@@ -0,0 +1,8 @@
+CXXFLAGS = -O2 -g -Wall
+
+all: tx-udp
+
+tx-udp: tx-udp.cc
+
+clean:
+       rm tx-udp


Property changes on: gnuradio/branches/developers/eb/gige/Makefile
___________________________________________________________________
Name: svn:eol-style
   + native

Added: gnuradio/branches/developers/eb/gige/tx-udp.cc
===================================================================
--- gnuradio/branches/developers/eb/gige/tx-udp.cc                              
(rev 0)
+++ gnuradio/branches/developers/eb/gige/tx-udp.cc      2006-12-30 15:41:21 UTC 
(rev 4205)
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <errno.h>
+#include <stdio.h>
+
+static const int PACKET_SIZE = 1024;
+
+bool
+main_loop(int sock, const struct sockaddr *dest_addr, socklen_t dest_len, 
size_t nbytes)
+{
+  unsigned char buf[PACKET_SIZE];
+  
+  size_t n = 0;
+  while (n < nbytes){
+    ssize_t r = sendto(sock, buf, sizeof(buf), 0, dest_addr, dest_len);
+    if (r < 0){
+      perror("sendto");
+      return false;
+    }
+
+    n += r;
+  }
+
+  return true;
+}
+
+int
+main(int argc, char **argv)
+{
+  size_t nbytes = 200 * 1000 * 1000;           // 200MB
+
+  int sock = socket(AF_INET, SOCK_DGRAM, 0);   // UDP socket
+  if (sock < 0){
+    perror("socket");
+    return 1;
+  }
+
+  struct sockaddr_in saddr;
+  saddr.sin_family = AF_INET;
+  saddr.sin_port = 45000;
+  saddr.sin_addr.s_addr =
+    (24 << 24) | (180 << 16) | (37 << 8) | (6 << 0); // 24.180.37.6 comsec.com
+  
+
+#if 0
+  if (bind(sock, (struct sockaddr *) &saddr, sizeof(saddr)) == -1){
+    perror("bind");
+    return 1;
+  }
+#endif
+
+  return main_loop(sock, (struct sockaddr *) &saddr, sizeof(saddr), nbytes) ? 
0 : 1;
+}


Property changes on: gnuradio/branches/developers/eb/gige/tx-udp.cc
___________________________________________________________________
Name: svn:eol-style
   + native





reply via email to

[Prev in Thread] Current Thread [Next in Thread]