[PD] Python socket to PD
Pall Thayer
palli at pallit.lhi.is
Tue Aug 10 23:21:37 CEST 2004
> message = ['hello PD']
try message = ['hello PD;\n']
Pall
On þri, 2004-08-10 at 20:48, joseph moore wrote:
> 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
--
_________________________________
Pall Thayer
artist/teacher
http://www.this.is/pallit
http://130.208.220.190
http://130.208.220.190/nuharm
http://130.208.220.190/panse
-----------------------------
More information about the Pd-list
mailing list