[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] How to "kill flowgraph" with a custom block
From: |
davidk |
Subject: |
Re: [Discuss-gnuradio] How to "kill flowgraph" with a custom block |
Date: |
Tue, 3 Jan 2017 01:53:29 -0700 (MST) |
Dear Marcus, Happy new year!
Here is my UDP Server Block Python Code:
/import numpy
import socket
from gnuradio import gr
from gnuradio import blocks
UDP_IP = "192.168.10.2"
UDP_PORT = 58
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
class serverSource(gr.sync_block):
def __init__(self):
gr.sync_block.__init__(self,name="serverSource",in_sig=None,out_sig=[numpy.float32])
print "Setting up server"
sock.bind((UDP_IP, UDP_PORT))
def work(self, input_items, output_items):
out = output_items[0]
data, addr = sock.recvfrom(1024)
packetString = repr(data)
packetString = packetString.replace('\\x00','')
packetString = packetString.replace('\'','')
print "message received: ", packetString
print "address: ", addr
if packetString == 'stop':
return -1
return len(output_items[0])/
and here is my UDP Broadcast block:
/import numpy
import socket
from gnuradio import gr
class udpBroadcast(gr.basic_block):
def __init__(self, ip, port, message):
gr.basic_block.__init__(self,name="udpBroadcast",in_sig=[numpy.float32],out_sig=[numpy.float32])
print "Setting up UDP Message"
UDP_IP = ip
UDP_PORT = port
MESSAGE = message
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))/
Hopefully you can make out what I'm aiming for here.
Many thanks
David
--
View this message in context:
http://gnuradio.4.n7.nabble.com/How-to-kill-flowgraph-with-a-custom-block-tp62332p62402.html
Sent from the GnuRadio mailing list archive at Nabble.com.
- Re: [Discuss-gnuradio] How to "kill flowgraph" with a custom block,
davidk <=
- Re: [Discuss-gnuradio] How to "kill flowgraph" with a custom block, davidk, 2017/01/03
- Re: [Discuss-gnuradio] [Bulk] Re: How to "kill flowgraph" with a custom block, Gisle Vanem, 2017/01/03
- Message not available
- Message not available
- Re: [Discuss-gnuradio] How to "kill flowgraph" with a custom block, Marcus Müller, 2017/01/04
- Message not available
- Re: [Discuss-gnuradio] How to "kill flowgraph" with a custom block, Marcus Müller, 2017/01/04
- Message not available
- Message not available
- Message not available
- Re: [Discuss-gnuradio] How to "kill flowgraph" with a custom block, Marcus Müller, 2017/01/04
- Re: [Discuss-gnuradio] How to "kill flowgraph" with a custom block, David Kersh, 2017/01/04
- Re: [Discuss-gnuradio] How to "kill flowgraph" with a custom block, Marcus Müller, 2017/01/04
- Re: [Discuss-gnuradio] How to "kill flowgraph" with a custom block, David Kersh, 2017/01/06