[PD] tcpserver and tcpclient

Roman Haefeli reduzent at gmail.com
Mon Mar 30 14:32:57 CEST 2020


On Mon, 2020-03-30 at 09:29 +0200, Edwin van der Heide wrote:

> As a strategy I would like to compare them to tcpserver and tcpclient
> in iemnet. My problem is that iemnet/tcpclient outputs the the
> received messages as bytes in individual messages instead of a list. 

Yeah. TCP is a stream-oriented protocol. If you want to send messages
through a serial line (such as TCP), you need some mechanism to delimit
packets. With FUDI, you can use the semi-colon character as delimiter.
However, things are a bit more complicated on the [tcpserver] side,
since you may receive parts of messages of different clients
intermittently. So, for each client you need to create a buffer that
holds incomplete messages until enough data for a complete message is
received.

I solved the delimiting part for OSC and FUDI for netpd-server. Check
the abstraction [tcpsocketserver] in:

https://github.com/reduzent/netpd-server/


> Tcpserver however does output the received messages as list.

Which one? [iemnet/tcpserver] does not, as far as I know. See above
reasons.

> I would like to further process the output of tcpclient with
> fudiparse and am looking for a good way to do this that is also light
> on the cpu.

Have you looked at [netsend] and [netreceive] from Pd? If you can,
check the not yet released Pd versions, since some effort has been put
into those objects, as Dan already mentioned. They speak FUDI natively,
no need to think about delimiting and stuff.

Also, is there a specific reason you need TCP and not UDP? Since UDP is
packet oriented, you don't need any delimiting there either. 

Roman





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20200330/bf2459fe/attachment-0001.sig>


More information about the Pd-list mailing list