discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] [Bulk] Re: How to "kill flowgraph" with a custom


From: Gisle Vanem
Subject: Re: [Discuss-gnuradio] [Bulk] Re: How to "kill flowgraph" with a custom block
Date: Tue, 3 Jan 2017 12:26:55 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

davidk wrote:

> 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))

Shouldn't there be a:
  sock.listen(1)
  self.clientsock, _ = sock.accept()

here?

>     def work(self, input_items, output_items):
>         out = output_items[0]
>         data, addr = sock.recvfrom(1024)

And I guess this should receive from the client sock. Not the server socket.
Hence:
   data, addr = self.clientsock.recvfrom(1024)

-- 
--gv



reply via email to

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