Sending via UDP with luasocket or python socket library

Making & changing box plugins and external apps
Post Reply
joseph
Posts: 2
Joined: Wed Jun 12, 2013 1:33 pm

Sending via UDP with luasocket or python socket library

Post by joseph »

Hello Open Vibers,

This is my first post, so : bravo and many thanks to the development team for providing such a useful open-source tool.

Now here's my problem :

I'm currently trying to send UDP messages from designer to a third-party software running on localhost.
I have tried the trick in the sticky note from Yann Renard about luasocket, adapting it for UDP.
I also tried to insert some socket code in the python-sinus-oscillator example to send test packets.

I precise that I'm listening to the port with pd-extended, which I plan to use as a media manager for some EEG experiments.
I also precise that I'm running ov-designer on virtualbox with an ubuntu 12.04 guest, on a macosx host, but I see no reason why this could lead to local networking troubles.

Nothing arrives, like if packets woulnd't go out of OpenVibes.
Maybe I have to set some global variable somewhere to enable that ?
Or maybe I'm missing some basic point ...
For the moment I'm looking for a way to do he same thing with VRPN, but my preference still goes to raw UDP (and OSC in general).

Could please someone enlighten me ?

Thanks,
Joseph

jtlindgren
Posts: 778
Joined: Tue Dec 04, 2012 3:53 pm
Location: INRIA Rennes, FRANCE

Re: Sending via UDP with luasocket or python socket library

Post by jtlindgren »

Hi Joseph,

can you send UDP packets successfully from a stand-alone python interpreter from the virtual machine shell to the same port, having identical conditions? If not, the problem is likely outside OpenViBE. If yes, we'll need to examine how OpenViBE affects this.


Cheers,
Jussi

joseph
Posts: 2
Joined: Wed Jun 12, 2013 1:33 pm

Re: Sending via UDP with luasocket or python socket library

Post by joseph »

Hi Jussi,

You were right, that was my fault.
My packets were too long and Pure data dropped them.
I thought that at least I would see something in Pd's console.
I finally managed to see them as raw ascii codes, listening to the packets with the object [mrpeach/udpreceive] (although I didn't find how to force UDP packets size in python yet. I'm new to python ...).

After that I installed the pyOSC library, and now I can send the packets from pyOSC and Pd sees them as it should without any formatting.
So easy, just a few lines of code :) (I copy-pasted the basic_send.py example from ixi-audio in the python-sinus-oscillator.py example file, and it directly worked)
No need for "import socket" anymore, just "import OSC"

Thanks for the help, Jussi
I hope this can help too

Cheers,
Joseph

Aness
Posts: 2
Joined: Thu Apr 02, 2015 3:15 am

Re: Sending via UDP with luasocket or python socket library

Post by Aness »

I am trying the same UDP communication with a third party software but i didn't use LUA for that, I used the Exemple provided named VRPN TO OPENVIBE and modified it to include a UDP server to communicate with the localhost app. now, i really wonder if python is faster?.

https://github.com/aness/VRPN-TO-OPENVI ... ver-Added-

Post Reply