[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] "max recursion depth exceeded" error solved and n
From: |
W. David Li |
Subject: |
Re: [Discuss-gnuradio] "max recursion depth exceeded" error solved and new problem playing sound |
Date: |
Fri, 07 Mar 2008 11:35:19 -0800 |
It turned out I forgot to init the top block. So this problem is gone.
The new problem is I can't make the receiving machine to play a sound.
The client is sending a sine waveform like this:
class Client2(gr.top_block):
def __init__(self, addr, port):
gr.top_block.__init__(self, 'client2')
self._locatie = (addr, port)
self._clientsock = socket (AF_INET, SOCK_STREAM)
self._clientsock.connect(self._locatie)
self._src = gr.sig_source_f(44100, gr.GR_SIN_WAVE, 500, 0.8)
self._file_sink = gr.file_descriptor_sink(gr.sizeof_float,
self._clientsock.fileno())
def connect(self):
try:
self.connect(self._src, self._file_sink)
except Exception, e:
print 'client2 connect failure:',e
def run_client(self):
self.run()
print ' client is running '
def stop_client(self):
self.stop()
self.clientsock.close()
print ' client is stopped '
if __name__ == '__main__':
address = sys.argv[1]
port = int(sys.argv[2])
print ' Trying to connect to:', address, port
c = Client2(address, port)
c.run_client()
while True: pass
#c.stop_client()
print ' Done sending waveform to server!'
And the server on the receiving machine is receiving like this:
class Server2(gr.top_block):
def __init__(self):
gr.top_block.__init__(self, 'server2')
self._serversock = socket(AF_INET, SOCK_STREAM)
#serversock.bind has to use "" for other clients not on
#the same host
self._serversock.bind(("", 12345))
self._serversock.listen(1)
print 'Ready to receive sin-wave file'
sys.stdout.flush()
def start_listen(self):
self._clientsock, self._clientaddr = self._serversock.accept()
print 'Got client connection', self._clientsock,
self._clientaddr
sys.stdout.flush()
try:
self._filesrc = gr.file_descriptor_source(gr.sizeof_float,
self._clientsock.fileno())
self._audio_sink = audio.sink(44100)
self.connect(self._filesrc, self._audio_sink)
except Exception, e:
print ' Error in start_listen: ', e
def run_server(self):
self.run()
if __name__ == '__main__':
s = Server2()
s.start_listen()
s.run_server()
On Thu, 2008-03-06 at 16:00 -0800, Johnathan Corgan wrote:
> On 3/6/08, W. David Li <address@hidden> wrote:
>
> > I got this error when connecting a file_descriptor source to an audio
> > sink in a top_block. Any ideas what might have gone wrong?
>
> That error can happen if you try to access a method name of a
> hierarhical block that doesn't exist. Look for a typo.
>