I have a question concerning udp packets in MATLAB. I've been using the oscsend.m script to send udp packets to other applications. http://www.mathworks.fr/matlabcentral/fileexchange/31400-send-open-sound-control-osc-messages/content/oscsend.m It works normaly. however, now I need to make use of the pnet function from the TCP/UDP/IP Toolbox 2.0.6 http://www.mathworks.de/matlabcentral/fileexchange/345-tcpudpip-toolbox-2-0-6 because I no longer have access to the instrument control toolbox in Matlab, which oscsend makes use of.
I looked up online for answers and even contacted the authors with no luck so far. Even though the problem seems trivial I couldn't make it work.
normally the usage with the Instrument Control toolbox would be:
u = udp('127.0.0.1', 12345) %12345 being the port
fopen(u)
oscsend(u, /test, 'f', 1.05) %"f" indicating a floating number
but now without udp or fopen I tried to use pnet like this
%write data to UDP
data = [oscstr(path) types data];
sock=pnet('udpsocket',12345) %it returns 0, a sign that the socket is working
%however when I try to send the oscsend signal through this socket nothing happens
pnet(sock, 'writepacket' data) %data being the output of oscsend
I also tried with no luck integrating the pnet function to oscsend but I couldn't recieve a signal, (I am working with another instance of MATLAB which is recieving the data sent from the previoulsy mentioned port). This is what I did inside oscsend and none of them worked
%write data to UDP
data = [oscstr(path) types data];
%pnet(u, 'writepacket', data, '127.0.0.1', 12345 );%
%pnet u 'write' data %
%pnet(u,'write',data, '127.0.0.1', 12345 )
%pnet(u,'write',data, '127.0.0.1', 12345 ) %returned value?
%pnet(0,'write',data, '127.0.0.1', 12345 ) %
%sock = pnet('udpsocket',12345 ); %
%pnet(sock,'write', data, '127.0.0.1', 12345 )
Thanks to all of you in advance who took the time to read this. Best. Mario.