Sin_wave -> socket -> socket -> Audio sink

Hi guys,

I’m working on GNU radio for about two weeks now. I was trying to build
a
flow graph, consisting of a sin_wave → Socket (localhost) →
socket(localhost) → audio.sink. However I run into problems. Could
someone
take a look at my code to see whether I made big mistakes? Please reply
in
not too much detail. I’m a telecom guy, trying to dive into all the
software
code which means I’m not 100% familiar with Python. The error is a
“file_descriptor_source[read]: Bad file descriptor”. I’ve searched the
forum
about this error, but wasn’t able to find anything that could help me.
The
code is below.

Thanks,
Teun

This is my server.py:

#!/usr/bin/env python
from socket import *
import sys
from gnuradio import audio
from gnuradio import gr
fg = gr.flow_graph()
locatie=(‘localhost’,12345)
serversock = socket(AF_INET, SOCK_STREAM)
serversock.bind(locatie)
serversock.listen(2)
print ‘Ready to send over accept sin wave’
sys.stdout.flush()
clientsock, adres = serversock.accept()
filesrc = gr.file_descriptor_source(gr.sizeof_float,
clientsock.fileno())
audio_sink = audio.sink (48000)
fg.connect(filesrc,audio_sink)
fg.start()
fg.stop()
serversock.close()

And this i is my client.py :

#!/usr/bin/env python
from socket import *
import sys
import os
import string
from gnuradio import gr
locatie = (‘localhost’, 12345)
clientsock = socket(AF_INET, SOCK_STREAM)
clientsock.connect(locatie)
src = gr.sig_source_f(48000, gr.GR_SIN_WAVE, 500, 0.1)
fg = gr.flow_graph()
file_sink = gr.file_descriptor_sink (gr.sizeof_float,
clientsock.fileno())
fg.connect(src,file_sink)
fg.start()
fg.stop()
clientsock.close()


View this message in context:
http://www.nabble.com/Sin_wave-->-socket-->-socket-->-Audio-sink-tf3808637.html#a10779300
Sent from the GnuRadio mailing list archive at Nabble.com.