python to max udpreceive

Nov 4, 2007 at 4:47pm

python to max udpreceive

hello people…

i try to make python and max msp communicate through simple udpsend and receive objects on max..

this is my python script:
##################################
from socket import *

host = “localhost”
port = 20000
buf = 1024
addr = (host, port)

UDPSock = socket(AF_INET,SOCK_DGRAM)

def_msg = “===Enter message to send to server===”;
print “n”,def_msg

while (1):
data = raw_input(‘>> ‘)
if not data:
break
else:
if(UDPSock.sendto(data,addr)):
print “Sending message ‘”,data,”‘…..”

# Close socket
UDPSock.close()

###################################################

I use this script to send data to udpreceive object in maxmsp…

the problem is that when i run the script from python, maxmsp prints:

net.recv.udp: OSC packet size (1) not a multiple of bytes: dropping

i tried various types of messages and the only thing that changed was the OSC packet size()

Whats the problem here? And why maxmsp reads osc, while i send simple udp messages?

im not very experienced in scripting so its very difficult for me to understand OSC so i try to use simple udp messages…

#34452
Nov 5, 2007 at 8:38am

#116289
Nov 5, 2007 at 4:57pm

i tried the argument CNMAT HTH in udpreceive object…

i connected it with a print oblect and it prints:

Full packet 2 80707376

I understand that this is the packet information but how can i receive the message it self on the max patch?

Sorry maybe its obvious, but OSC is very difficult and there is no simple tutorials to learn it….

#116290
Nov 5, 2007 at 7:59pm

On 05 Nov 2007, at 17:57, tom wrote:
>
> I understand that this is the packet information but how can i
> receive the message it self on the max patch?
>
> Sorry maybe its obvious, but OSC is very difficult and there is no
> simple tutorials to learn it….

no need for osc if you simply use [mxj net.udp.recv @port 20000].
works fine with your script.

volker.

#116291
Nov 5, 2007 at 8:10pm

Quote: tomaso wrote on Mon, 05 November 2007 08:57
—————————————————-
> i tried the argument CNMAT HTH in udpreceive object…
>
> i connected it with a print oblect and it prints:
>
> Full packet 2 80707376
>
> I understand that this is the packet information but how can i receive the message it self on the max patch?
>
> Sorry maybe its obvious, but OSC is very difficult and there is no simple tutorials to learn it….
>
>
—————————————————-
Connect it to an OpenSoundControl object which you’ve downloaded from here:

http://www.cnmat.berkeley.edu/MAX/downloads/

mz

#116292
Nov 5, 2007 at 8:55pm

i connected udpreceive CNMAT HTH oblect with opensoundcontrol object,
but i can’t find a way to receive the message…

it works with mxj.net.udp, but maybe i have to start learning osc
osc documentation doesnt help much..you have to be experienced to understand…

any suggestions on learning osc?

#116293

You must be logged in to reply to this topic.