Hi all
Sorry to barge in without myself being involved in the matters, but I remember, that also IOhannes was working on addressing some issues of [tcpserver]. His results are in svn/externals/iem/iemnet. I haven't thoroughly tested, if those versions already solved the issues Ivica was posting. However, I thought it's worth mentioning those as well, so that forces might be joined. I have the impression, that similar problems are worked on twice on two completely different ends.
Roman
On Wed, 2010-05-05 at 23:57 -0400, Martin Peach wrote:
Ivica Ico Bukvic wrote:
Martin,
...
please send me a brief flow of functions "broadcast" calls so that I can figure out where to look for potential fixes/improvements.
Well broadcast calls tcpserver_send_bytes() once for each connected client. tcpserver_send_bytes() fills a buffer from the input message and spawns a thread running tcpserver_send_buf_thread() to send the content whenever the buffer is full or the message is completely converted from atoms to bytes.
I think as long as your messages all fit in a single buffer it's a lot easier. The snag is that tcpserver_send_bytes() can fill the buffer more than once for each message if the message is > 64k. Apart from that, to skip redundant conversion of atom to byte and multiple thread creation, I would make a single buffer from the input and pass it to a single thread that sends the same buffer to each connected client. Since the current tcpserver_send_bytes() can also be used to send very long files, it may be better to make a dedicated broadcast function that only does small packets (less than 65536 bytes), as broadcasting megabytes to many clients will no doubt peg the machine.
Martin
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev