discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] gmsk and sockets


From: James Cooley
Subject: Re: [Discuss-gnuradio] gmsk and sockets
Date: Fri, 11 Mar 2005 17:16:20 -0500
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

In using socket file descriptors, what is different about Bob's setup and mine? I'm trying to create a very basic example of writing a sin source over socket to display and end up getting "Bad file descriptor" errors and the thing connects and then dies with:

Connection:  <socket._socketobject object at 0xb601861c>
Address:  ('127.0.0.1', 32942)
gr_file_descriptor_sink: Bad file descriptor

The heart of the code is below, I specify -s to make it a server, else it's the client. I notice Bob is using bytes I'm using complex, could this be part of it? Is there a quick and dirty way to convert between the two (don't see a filter for this one)?

-jamie

==================================================

       parser = OptionParser (option_class=eng_option)
parser.add_option ("-s", "--server", action="store_true",default=False) parser.add_option ("-i", "--address", type="string",default="localhost")
       parser.add_option ("-p", "--port", type="int",default=8881)
(options, args) = parser.parse_args () # Create socket
       fd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
       #sock.setblocking(0)

       # set rate
       rate = 8e6
# Now we decide if we're client or server
       if(options.server == True):
           #
           # server is sending data
           #
# Ensure you can restart server quickly when it terminates
           fd.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# set the client sock's TCP num
           fd.bind(('0.0.0.0',options.port))
           fd.listen(2)
           (conn, connaddr) = fd.accept()
           print "Connection: ", conn
           print "Address: ", connaddr

           # setup socket file sink
filesink = gr.file_descriptor_sink(gr.sizeof_gr_complex, conn.fileno())

           # setup signal source
           ampl = 0.1
           freq = 440
           src = gr.sig_source_c(rate, gr.GR_SIN_WAVE, freq, ampl)
# connect it up
           self.connect(src,filesink)

       else:
           #
           # client is receiving data and displaying it
           #
# make socket
           fd.connect((options.address,options.port))
           print "Connection: ", fd

           # setup file src
src = gr.file_descriptor_source(gr.sizeof_gr_complex, fd.fileno(), True)

           # setup display
           options.avg = 10
fftsink, fft_win = make_fft_sink_c (self, panel, "", 512, rate,True,False,options.avg,-1) # connect and add
           self.connect(src,fftsink)

           vbox.Add (fft_win, 1, wx.EXPAND)












Eric Blossom wrote:

On Thu, Mar 10, 2005 at 10:46:05AM -0500, Bob Vincent wrote:
I've modified fsk_*.py to allow connections via options: above from a socket, below to a named pipe.
I've also incorporated gmsk code published here as a modulation option.

Needs the gmsk.py that floated past. Thanks to Joshua Lackey. Joshua, here's your feedback: It works! ;)

As expected, gmsk works better. Also is nicer to the interpolating filter on the USRP board. I've enclosed my files. If someone wants to improve and/or distribute them via the cvs tree, go right ahead.

Thanks!

Eric


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio





reply via email to

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