[PD] socket object?

Roman Haefeli reduzent at gmail.com
Thu Feb 16 17:41:39 CET 2012


On Thu, 2012-02-16 at 16:58 +0100, IOhannes m zmölnig wrote:
> On 02/16/12 16:46, Pagano, Patrick wrote:
> > Hi and thanks
> > We are listening for tcp
> > in max i get the lines read as
> > LaserOutput: [[[2705,246]],[[1358,402]]]
> >
> > and in pd using mrpeach's tcpclient it reads back
> > 91 91 91 50 54 54 49 44 50 56 54 93 93 44 91 91 49 51 54 53 44 52 49 56 93 93 93 13 10
> >
> > i of course want to strip off the brackets and close brackets and just get to the numbers inside the strings
> > is this possible? Can i convert the bytes to characters/numbers?
> 
> moocow's "pdstring" library might come in handy.
> 
> you could also try to do something like this:
> 
> [tcpclient 7777]
> |
> [list append 59 10]
> |
> [list prepend send]
> |
> [list trim]
> |
> [udpsend]<-[connect localhost 7777(

This won't work, because TCP is a stream-based protocol and you cannot
be sure, that the whole _message_ comes in one chunk, or that one chunk
contains only one message. It's anyway only mrpeach's [tcpclient] that
outputs the incoming stream as chunks (Pd lists). iemnet's [tcpclient]
outputs the incoming stream as a stream of Pd floats (which is IMHO the
appropriate way).

Roman





More information about the Pd-list mailing list