summaryrefslogtreecommitdiff
path: root/gnuradio-examples/python/network/dial_tone_sink.py
diff options
context:
space:
mode:
authorDon Ward2010-04-30 14:48:56 -0400
committerDon Ward2010-04-30 14:48:56 -0400
commit3ff43f7487b43436cd0f49de80ebff2c1ff1a188 (patch)
tree3ef94f3a602f50a828c3b61726117ddd2043cf33 /gnuradio-examples/python/network/dial_tone_sink.py
parent3b8fcaa640d75573d314fb8616969ad2adf2a099 (diff)
downloadgnuradio-3ff43f7487b43436cd0f49de80ebff2c1ff1a188.tar.gz
gnuradio-3ff43f7487b43436cd0f49de80ebff2c1ff1a188.tar.bz2
gnuradio-3ff43f7487b43436cd0f49de80ebff2c1ff1a188.zip
Updates to udp source/sink (select(), wait, cleanup)
Use select() to avoid blocking on recv() in gr_udp_source (only known way to avoid blocking on Cygwin). Add wait argument to gr_udp_source to allow waiting for connection or accepting lack of connection as EOF; add --no-wait option to dial_tone_sink.py. Remove system dependencies from .h files; remove unused data members and (useless?) public open and close functions.
Diffstat (limited to 'gnuradio-examples/python/network/dial_tone_sink.py')
-rwxr-xr-xgnuradio-examples/python/network/dial_tone_sink.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/gnuradio-examples/python/network/dial_tone_sink.py b/gnuradio-examples/python/network/dial_tone_sink.py
index 47d24b9bc..82e925baa 100755
--- a/gnuradio-examples/python/network/dial_tone_sink.py
+++ b/gnuradio-examples/python/network/dial_tone_sink.py
@@ -25,9 +25,9 @@ from gnuradio.eng_option import eng_option
from optparse import OptionParser
class dial_tone_sink(gr.top_block):
- def __init__(self, src, port, pkt_size, sample_rate):
+ def __init__(self, src, port, pkt_size, sample_rate, wait):
gr.top_block.__init__(self, "dial_tone_sink")
- udp = gr.udp_source(gr.sizeof_float, src, port, pkt_size)
+ udp = gr.udp_source(gr.sizeof_float, src, port, pkt_size, wait=wait)
sink = audio.sink(sample_rate)
self.connect(udp, sink)
@@ -41,6 +41,8 @@ if __name__ == '__main__':
help="packet size.")
parser.add_option("-r", "--sample-rate", type="int", default=8000,
help="audio signal sample rate [default=%default]")
+ parser.add_option("-n", "--no-wait", action="store_true", default=False,
+ help="don't wait for source")
(options, args) = parser.parse_args()
if len(args) != 0:
parser.print_help()
@@ -48,7 +50,8 @@ if __name__ == '__main__':
# Create an instance of a hierarchical block
top_block = dial_tone_sink(options.src_name, options.src_port,
- options.packet_size, options.sample_rate)
+ options.packet_size, options.sample_rate,
+ not options.no_wait)
try:
# Run forever