Forwarding UDP debug data through server - I thought this would be easy!

There is 1 reply in this Thread which was already clicked 200 times. The last Post () by Johnny Elton.

  • I like to be able to keep an eye on Mgcamd's logging output as I'm playing around, and as you know it can send it out to a UDP port.
    So I set the logging option in mg_cfg to

    Code
    L: { 03 } 192.168.0.5 29000

    and on the PC (Ubuntu laptop on .5) use netcat to view it

    Code
    nc -u -l -vv 29000


    which works fine.


    However, as I have a few different PCs on my home network, it was a pain in the arse having to change mg_cfg and restart if I wanted to view the output with a different PC.


    I tried setting mgcamd to send it to the broadcast address 192.168.0.255 29000 - but that didn't work. No problem I thought, I'll get mgcamd to send to my home server (ie an ancient laptop :-) ) and just broadcast it from there.


    Fuck me, something so simple has been doing my head in!


    I tried various approaches with netcat, but netcat couldn't open a broadcast connection

    Code
    y@ubuntu:~$ echo "test" | nc -u -vv 192.168.0.255 29123
    nc: connect to 192.168.0.255 port 29123 (udp) failed: Permission denied


    so after a bit of googling I moved to socat to do the forwarding on the server, eventually arriving with

    Code
    socat EDP4-RECVFROM:29000,fork UDP4-SENDTO:192.168.0.255:29001,broadcast


    But with the data being forwarded, when I try to receive it with netcat an a PC, it only gets one line, and then just sits there!

    Code
    nc -u -l -vv 29000


    AAARRRGGGGHHHHHHH! I really thought that even to a Linux & networking imbecile like me this would be simple!


    Hopefully some of the experts can tell me what stupid mistake I'm making!

  • Got this sorted, so you can put the world's most boring thread to bed....


    I had to use

    Code
    socat -u udp-recv:29001 -


    on the receiving laptop, instead of good old netcat. Even that took me a while as it throws an error if you don't include the last hypen...

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!