[PD] Python socket to PD

Joseph A. Sarlo jsarlo at ucsd.edu
Tue Aug 10 23:21:24 CEST 2004


Hi,

GrIPD does exactly this, and the source is available.
http://crca.ucsd.edu/~jsarlo/gripd

Joe
jsarlo at ucsd.edu

----- Original Message -----
From: "joseph moore" <joseph_moore_ at hotmail.com>
To: <pd-list at iem.at>
Sent: Tuesday, August 10, 2004 1:48 PM
Subject: [PD] Python socket to PD


> Hello list,
> How should one go about sending information (in this case text) from
Python
> to PD.  I know about the Python objects for PD but I want to have the
Python
> script be able to run outside PD and with with a wxPython GUI.  So, right
> now I'm just trying to send a simple text message from Python to PD.  I
have
> a netreceive connected to port 50007 and am running the following Python:
>
> import sys
> from socket import *
> serverHost = 'localhost'
> serverPort = 50007
>
> message = ['hello PD']
> if len(sys.argv) > 1:
> serverHost = sys.argv[1]
> if len(sys.argv) > 2:
> message = sys.argv[2:]
>
> sockobj = socket(AF_INET, SOCK_STREAM)
> sockobj.connect((serverHost, serverPort))
>
> for line in message:
> sockobj.send(line)
> data = sockobj.recv(1024)
> print 'Client received', data
> sockobj.close()
>
> This is a little OT but I would appreciate help none the less ; )
>
> best,
> Joe(mediocre Python programmer trying to get better)
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>
> _______________________________________________
> PD-list mailing list
> PD-list at iem.at
> to manage your subscription (including un-subscription) see
> http://iem.at/cgi-bin/mailman/listinfo/pd-list





More information about the Pd-list mailing list