Using file descriptor sink?

Hello GR,

Can anyone please give me some hints on how to use gr-file descriptor
sink
in a gnuradio python flowgraph.

Regards,
Ruecan


View this message in context:
http://gnuradio.4.n7.nabble.com/Using-file-descriptor-sink-tp48640.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Hi Ruecan,

if you’re asking this question, you probably shouldn’t use
file_descriptor_sink.
It works quite like file_sink, but instead of a filename, you pass a
file descriptor, which is the int handler the open() syscall will
return.

Greetings,
Marcus

Ah sorry, forgot the important part: If you have opened a file from
python, let’s say by:

myfile = open("/home/ruecan/secretplanforworlddominance.pdf", “r”)

you can get the file descriptor by doing
fd = myfile.fileno()

Greetings,
Marcus

My question is let say I have this socket

 self.blocks_socket_pdu_0_Rx = blocks.socket_pdu("UDP_CLIENT",

“localhost”, “4000”, 10000)

And then I need to associate a file descriptor to it.
How can I have the int handler like the open() syscall would return ?

 self.myFileDescriptor = blocks.file_descriptor_sink(2048, ??)

Ruecan.


View this message in context:
http://gnuradio.4.n7.nabble.com/Using-file-descriptor-sink-tp48640p48644.html
Sent from the GnuRadio mailing list archive at Nabble.com.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sorry, I don’t understand. Could you rephrase/elaborate on that?
Where does the file descriptor come into play?

On 30.05.2014 18:15, Ruecan wrote:

Ruecan.

– View this message in context:
http://gnuradio.4.n7.nabble.com/Using-file-descriptor-sink-tp48640p48644.html

Sent from the GnuRadio mailing list archive at Nabble.com.

_______________________________________________ Discuss-gnuradio
mailing list [email protected]
Discuss-gnuradio Info Page

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTiLDtAAoJEBQ6EdjyzlHtsaQIAKlg6oAbSxm+MM7U5nkDm1sQ
ppsjH7wuLB1IjocpLjDonIrXDEJDzzTpOxdT7p3LJUgujUHs9pKAq+W7IdccRy+u
J1KzKYrvbdjOoWbpBVMymJ6IjkuTOYrlQKEOB9Z1sd73Y3zkhKYk8+HYx+nPXd2O
76BY6AqvWEAlBl7VQTqR+dx/v5M5rU90eyanBN25A+V8lieUeU7s6D0qvcpsNuQZ
35Qfdg5mTIcduc0k5k02l7HQAr+dXkTveqhRKlnffXIFPccMp1vrrYbQQlLMCKPJ
vSlfc+a7+uYvSOzjV6Tckbiux5oGOMn3EiTUhgJzLX8UY67a9VzKmd7YGnrwxmw=
=NeMU
-----END PGP SIGNATURE-----

I mean if I try this:

self.blocks_socket_pdu_0_Rx = blocks.socket_pdu(“UDP_CLIENT”, “localhost”,
“4000”, 10000)
self.myFileDescriptor = blocks.file_descriptor_sink(2048,
open(self.blocks_socket_pdu_0_Rx, ‘r+b’))

I got:
TypeError: coercing to Unicode: need string or buffer, socket_pdu_sptr
found

I don’t know how to get a file descriptor out of that to read it and
retrieve packets received.


View this message in context:
http://gnuradio.4.n7.nabble.com/Using-file-descriptor-sink-tp48640p48647.html
Sent from the GnuRadio mailing list archive at Nabble.com.

I think you’re mixing things up.
open() like you use it is a call to generate a python “file” object,
which is not the file descriptor a file_destructor_sink needs.
open() expects a string, but you offer a socket_pdu shared pointer (ie.
the python (swig) representation of the C++ block of that name).

I don’t really understand what you are trying to do; could you explain?
I’m fairly certain file_descriptor_sink is not what you want…

Greetings,
Marcus