I am trying to record data directly from a UDP stream to file. I have four channels at 1.2MHz sample rate the code is below. Basically it opens a UDP source and connects to a file sink. However, It is losing data when writing to the file. If I stream a signal with a one second burst the spacing is not correct. Also, I have another c++ program that reads the UDP packets and records directly to file, and there are no lost UDP packets nor lost data with this program. Also I have checked that the UDP packet size is less than 1472, it is currently at 1024 bytes.
Is there a way to see if file_sink is not able to handle that data rate, or to see if the UDP source cannot keep up?
from gnuradio import gr
from gnuradio.wxgui import waterfallsink2, stdgui2, fftsink2,scopesink2
from optparse import OptionParser
from gnuradio.qtgui import qtgui
self.sr = 1200000
self.channels = 4
self.FileLength = 5 #seconds of data in each file
self.filenum = -1
self.baseName = "udp_1k."
self.ipAdd = "192.168.100.178" #the ip of this computer
self.port = 3456
self.bufSize = self.channels*4096
self.signal = gr.udp_source(gr.sizeof_short,self.ipAdd,self.port)
self.thread = threading.Thread(target=self.FileThread)
print "could not disconnect"
self.dest = gr.file_sink(gr.sizeof_short,self.saveFile)
self.filenum = self.filenum + 1
self.saveFile = self.baseName + "%d"%self.filenum
print "writing to file: " + self.saveFile
if __name__ == '__main__':
app = stdgui2.stdapp(gnuradioGUI,"CAIS signal using GNU Radio GUI")
parser = OptionParser()
parser.add_option("-w", "--file", dest="filename",
help="write data to FILE", metavar= "FILE")
(options, args) = parser.parse_args()
NOTICE:This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.