aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2015-09-01 14:32:27 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2015-09-01 14:32:27 +0000
commit9f0009faeaa0960f57fcacea91b45997258016e0 (patch)
treef434613d74c0bebef7abfdbdb67e0bd55f3fa220
parente6f799e41d7910e1388c68630c49bf3141cb8d9c (diff)
synch more with git
svn path=/trunk/externals/iem/iemnet/; revision=17546
-rw-r--r--astyle.rc16
-rw-r--r--build/autotests/Makefile.am23
-rw-r--r--build/autotests/README.txt8
-rw-r--r--build/autotests/configure.ac23
-rw-r--r--build/autotests/m4/ax_pthread.m4288
-rw-r--r--build/autotests/tests/Makefile.am30
-rw-r--r--build/autotests/tests/common.h54
-rw-r--r--build/autotests/tests/fail.c5
-rw-r--r--build/autotests/tests/pass.c7
-rwxr-xr-xbuild/autotests/tests/runtest.sh43
-rw-r--r--build/autotests/tests/serialqueue.c58
-rw-r--r--build/autotests/tests/skip.c5
-rw-r--r--build/autotests/tests/threadedqueue.c77
-rw-r--r--build/coverity/coverity_model.c21
-rw-r--r--tests/README.txt30
-rw-r--r--tests/bandwidth.pd43
-rw-r--r--tests/delete/01_send-and-delete.pd11
-rw-r--r--tests/delete/test-sender.pd693
-rw-r--r--tests/packetgenerator.pd61
-rw-r--r--tests/reconnect/01_reconnect-crash.pd30
-rw-r--r--tests/reconnect/04_reconnect-dropped-byte-2-client.pd85
-rw-r--r--tests/reconnect/04_reconnect-dropped-byte-2-server.pd17
-rw-r--r--tests/reconnect/payload.pd7
-rw-r--r--tests/reconnect/reconnect-dropped-byte.pd56
-rw-r--r--tests/reconnect/serialize.pd17
-rw-r--r--tests/reconnect/sprint.pd20
-rw-r--r--tests/reflect/01_tcp.pd20
-rw-r--r--tests/reflect/02_udp.pd18
-rw-r--r--tests/reflect/03_tcpserver.pd59
-rw-r--r--tests/sequence/01_tcpclient.pd119
-rw-r--r--tests/sequence/01_tcpserver.pd59
-rw-r--r--tests/sequence/02_udpsendreceive.pd88
-rwxr-xr-xtests/tcpclient_reflect.sh29
-rw-r--r--tests/tcpclient_stress/01_crashertest.pd61
-rw-r--r--tests/tcpclient_stress/02_crasherclient.pd147
-rw-r--r--tests/tcpclient_stress/02_crasherserver.pd20
-rwxr-xr-xtests/tcpserver.py34
-rwxr-xr-xtests/tcpserver_reflect.sh29
-rwxr-xr-xtests/tcpsink.sh10
-rwxr-xr-xtests/tcpsource.sh10
-rwxr-xr-xtests/udpclient_reflect.sh30
-rwxr-xr-xtests/udpserver_reflect.sh29
-rwxr-xr-xtests/udpsink.sh10
-rwxr-xr-xtests/udpsource.sh10
44 files changed, 2510 insertions, 0 deletions
diff --git a/astyle.rc b/astyle.rc
new file mode 100644
index 0000000..d1be054
--- /dev/null
+++ b/astyle.rc
@@ -0,0 +1,16 @@
+## asytyle configuration for iemnet
+# usage: astyle --options=astyle.rc *.c *.h
+
+## CRLF line-ending
+lineend=linux
+
+## make sure that code fits on an old-school terminal
+max-code-length=75
+# maximum indentation on continuation lines
+max-instatement-indent=40
+
+## "One True Brace Style"
+style=1tbs
+
+## hardly an indentation
+indent=spaces=2
diff --git a/build/autotests/Makefile.am b/build/autotests/Makefile.am
new file mode 100644
index 0000000..d5ca046
--- /dev/null
+++ b/build/autotests/Makefile.am
@@ -0,0 +1,23 @@
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS=tests
+
+AM_CPPFLAGS = -I$(top_srcdir)
+
+lib_LTLIBRARIES = libiemnet.la
+
+libiemnet_la_LDFLAGS = -version-info 1 -no-undefined
+libiemnet_la_CFLAGS =
+#libiemnet_la_CFLAGS += -fvisibility=hidden
+libiemnet_la_LIBADD = $(LIBM)
+
+libiemnet_la_SOURCES = \
+ $(top_srcdir)/../../iemnet.c \
+ $(top_srcdir)/../../iemnet_data.c \
+ $(top_srcdir)/../../iemnet_receiver.c \
+ $(top_srcdir)/../../iemnet_sender.c \
+ $(top_srcdir)/../../iemnet_notify.c \
+ $(top_srcdir)/../../iemnet_data.h \
+ $(top_srcdir)/../../iemnet.h
+
diff --git a/build/autotests/README.txt b/build/autotests/README.txt
new file mode 100644
index 0000000..de17fb1
--- /dev/null
+++ b/build/autotests/README.txt
@@ -0,0 +1,8 @@
+autotools for iemnet
+====================
+
+currently, iemnet does NOT require autotools to build.
+
+what you find in here is mainly to run some automated tests, so the only useful
+build-target is:
+$ make check
diff --git a/build/autotests/configure.ac b/build/autotests/configure.ac
new file mode 100644
index 0000000..fdf381f
--- /dev/null
+++ b/build/autotests/configure.ac
@@ -0,0 +1,23 @@
+AC_INIT([iemnet],[0.0.1],[zmoelnig@iem.at],
+ [iemnet],[http://ambisonics.iem.at/xchange/format])
+AM_INIT_AUTOMAKE
+
+AM_PROG_LIBTOOL
+
+AC_CONFIG_SRCDIR([../../iemnet.h])
+
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_FILES([Makefile tests/Makefile])
+
+AC_PROG_INSTALL
+
+AC_LANG_C
+AC_PROG_CC
+AC_PROG_MAKE_SET
+AC_HEADER_STDC
+
+/* check for math */
+AC_CHECK_LIB([m],[sqrt])
+AX_PTHREAD
+
+AC_OUTPUT
diff --git a/build/autotests/m4/ax_pthread.m4 b/build/autotests/m4/ax_pthread.m4
new file mode 100644
index 0000000..eafd76a
--- /dev/null
+++ b/build/autotests/m4/ax_pthread.m4
@@ -0,0 +1,288 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+# This macro figures out how to build C programs using POSIX threads. It
+# sets the PTHREAD_LIBS output variable to the threads library and linker
+# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
+# flags that are needed. (The user can also force certain compiler
+# flags/libs to be tested by setting these environment variables.)
+#
+# Also sets PTHREAD_CC to any special C compiler that is needed for
+# multi-threaded programs (defaults to the value of CC otherwise). (This
+# is necessary on AIX to use the special cc_r compiler alias.)
+#
+# NOTE: You are assumed to not only compile your program with these flags,
+# but also link it with them as well. e.g. you should link with
+# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
+#
+# If you are only building threads programs, you may wish to use these
+# variables in your default LIBS, CFLAGS, and CC:
+#
+# LIBS="$PTHREAD_LIBS $LIBS"
+# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+# CC="$PTHREAD_CC"
+#
+# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
+# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
+# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+#
+# ACTION-IF-FOUND is a list of shell commands to run if a threads library
+# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
+# is not found. If ACTION-IF-FOUND is not specified, the default action
+# will define HAVE_PTHREADS.
+#
+# Please let the authors know if this macro fails on any platform, or if
+# you have any other suggestions or comments. This macro was based on work
+# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
+# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
+# Alejandro Forero Cuervo to the autoconf macro repository. We are also
+# grateful for the helpful feedback of numerous users.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 7
+
+AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
+AC_DEFUN([AX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+ax_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with
+CFLAGS=$PTHREAD_CFLAGS])
+ AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
+ AC_MSG_RESULT($ax_pthread_ok)
+ if test x"$ax_pthread_ok" = xno; then
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+ fi
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try. Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads
+-mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important. Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+# other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+# doesn't hurt to check since this sometimes defines pthreads too;
+# also defines -D_REENTRANT)
+# ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+ *solaris*)
+
+ # On Solaris (at least, for some versions), libc contains stubbed
+ # (non-functional) versions of the pthreads routines, so link-based
+ # tests will erroneously succeed. (We need to link with -pthreads/-mt/
+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
+ # a function called by this macro, so we could check for that, but
+ # who knows whether they'll stub that too in a future libc.) So,
+ # we'll just look for -pthreads and -lpthread first:
+
+ ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
+ ;;
+
+ *-darwin*)
+ acx_pthread_flags="-pthread $acx_pthread_flags"
+ ;;
+esac
+
+if test x"$ax_pthread_ok" = xno; then
+for flag in $ax_pthread_flags; do
+
+ case $flag in
+ none)
+ AC_MSG_CHECKING([whether pthreads work without any flags])
+ ;;
+
+ -*)
+ AC_MSG_CHECKING([whether pthreads work with $flag])
+ PTHREAD_CFLAGS="$flag"
+ ;;
+
+ pthread-config)
+ AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
+ if test x"$ax_pthread_config" = xno; then continue; fi
+ PTHREAD_CFLAGS="`pthread-config --cflags`"
+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config
+--libs`"
+ ;;
+
+ *)
+ AC_MSG_CHECKING([for the pthreads library -l$flag])
+ PTHREAD_LIBS="-l$flag"
+ ;;
+ esac
+
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Check for various functions. We must include pthread.h,
+ # since some functions may be macros. (On the Sequent, we
+ # need a special flag -Kthread to make this header compile.)
+ # We check for pthread_join because it is in -lpthread on IRIX
+ # while pthread_create is in libc. We check for pthread_attr_init
+ # due to DEC craziness with -lpthreads. We check for
+ # pthread_cleanup_push because it is one of the few pthread
+ # functions on Solaris that doesn't have a non-functional libc stub.
+ # We try pthread_create on general principles.
+ AC_TRY_LINK([#include <pthread.h>
+ static void routine(void* a) {a=0;}
+ static void* start_routine(void* a) {return a;}],
+ [pthread_t th; pthread_attr_t attr;
+ pthread_join(th, 0);
+ pthread_attr_init(&attr);
+ pthread_cleanup_push(routine, 0);
+ pthread_create(&th,0,start_routine,0);
+ pthread_cleanup_pop(0); ],
+ [ax_pthread_ok=yes])
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ AC_MSG_RESULT($ax_pthread_ok)
+ if test "x$ax_pthread_ok" = xyes; then
+ break;
+ fi
+
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$ax_pthread_ok" = xyes; then
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+ AC_MSG_CHECKING([for joinable pthread attribute])
+ attr_name=unknown
+ for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+ AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
+ [attr_name=$attr; break])
+ done
+ AC_MSG_RESULT($attr_name)
+ if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+ AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+ [Define to necessary symbol if this constant
+ uses a non-standard name on your system.])
+ fi
+
+ AC_MSG_CHECKING([if more special flags are required for pthreads])
+ flag=no
+ case "${host_cpu}-${host_os}" in
+ *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+ *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+ esac
+ AC_MSG_RESULT(${flag})
+ if test "x$flag" != xno; then
+ PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+ fi
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ # More AIX lossage: must compile with xlc_r or cc_r
+ if test x"$GCC" != xyes; then
+ AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+ else
+ PTHREAD_CC=$CC
+ fi
+else
+ PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$ax_pthread_ok" = xyes; then
+ ifelse([$1],,AC_DEFINE(HAVE_PTHREADS,1,[Define if you have POSIX threads
+libraries and header files.]),[$1])
+ :
+else
+ ax_pthread_ok=no
+ $2
+fi
+AC_LANG_RESTORE
+])dnl AX_PTHREAD
+
diff --git a/build/autotests/tests/Makefile.am b/build/autotests/tests/Makefile.am
new file mode 100644
index 0000000..1a5f7f7
--- /dev/null
+++ b/build/autotests/tests/Makefile.am
@@ -0,0 +1,30 @@
+AUTOMAKE_OPTIONS = foreign
+AM_LDFLAGS= -module -avoid-version -shared -shrext .pd_linux
+
+TEST_EXTENSIONS = .la
+LA_LOG_COMPILER = $(srcdir)/runtest.sh
+
+AM_CPPFLAGS=-I$(top_srcdir)/../..
+AM_LDFLAGS+=$(top_builddir)/libiemnet.la -rpath /tmp
+
+SOURCES=common.h
+noinst_HEADERS=common.h
+EXTRA_DIST=runtest.sh
+
+TESTS = \
+ pass.la skip.la fail.la \
+ serialqueue.la threadedqueue.la
+
+XFAIL_TESTS = fail.la
+
+check_LTLIBRARIES= \
+ pass.la skip.la fail.la \
+ serialqueue.la threadedqueue.la
+
+pass_la_SOURCES=pass.c
+skip_la_SOURCES=skip.c
+fail_la_SOURCES=fail.c
+
+threadedqueue_la_SOURCES=threadedqueue.c
+serialqueue_la_SOURCES=serialqueue.c
+
diff --git a/build/autotests/tests/common.h b/build/autotests/tests/common.h
new file mode 100644
index 0000000..abef2c8
--- /dev/null
+++ b/build/autotests/tests/common.h
@@ -0,0 +1,54 @@
+#ifndef TESTS_COMMON_H
+#define TESTS_COMMON_H
+
+#include "iemnet.h"
+
+#include <stdlib.h>
+static inline void pass(void) {exit(0); }
+static inline void fail(void) {exit(1); }
+static inline void skip(void) {exit(77); }
+
+#include <stdio.h>
+#include <stdarg.h>
+static inline void pass_if (int test, int line, const char *format, ...)
+{
+ if (test) {
+ va_list argptr ;
+ printf("@%d: ", line);
+ va_start (argptr, format) ;
+ vprintf (format, argptr) ;
+ va_end (argptr) ;
+ printf("\n");
+ pass();
+ } ;
+} /* pass_if */
+static inline void skip_if (int test, int line, const char *format, ...)
+{
+ if (test) {
+ va_list argptr ;
+ printf("@%d: ", line);
+ va_start (argptr, format) ;
+ vprintf (format, argptr) ;
+ va_end (argptr) ;
+ printf("\n");
+ skip();
+ } ;
+} /* skip_if */
+static inline void fail_if (int test, int line, const char *format, ...)
+{
+ if (test) {
+ va_list argptr ;
+ printf("@%d: ", line);
+ va_start (argptr, format) ;
+ vprintf (format, argptr) ;
+ va_end (argptr) ;
+ printf("\n");
+ fail();
+ } ;
+} /* fail_if */
+
+#define STRINGIFY(x) #x
+#define STARTTEST(x) printf("============ %s[%04d]:\t%s '%s'\n", __FILE__, __LINE__, __FUNCTION__, x)
+
+#endif /* TESTS_COMMON_H */
+
diff --git a/build/autotests/tests/fail.c b/build/autotests/tests/fail.c
new file mode 100644
index 0000000..a2cb791
--- /dev/null
+++ b/build/autotests/tests/fail.c
@@ -0,0 +1,5 @@
+#include "common.h"
+
+void fail_setup() {
+ fail();
+}
diff --git a/build/autotests/tests/pass.c b/build/autotests/tests/pass.c
new file mode 100644
index 0000000..153e735
--- /dev/null
+++ b/build/autotests/tests/pass.c
@@ -0,0 +1,7 @@
+#include "common.h"
+
+
+void pass_setup(void) {
+ pass();
+}
+
diff --git a/build/autotests/tests/runtest.sh b/build/autotests/tests/runtest.sh
new file mode 100755
index 0000000..396d793
--- /dev/null
+++ b/build/autotests/tests/runtest.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+EXTERNAL=$1
+EXTERNAL=${EXTERNAL%.la}
+EXTERNAL=${EXTERNAL#./}
+
+TESTTYPE=$2
+
+
+##################################
+
+PD=pd
+PDARGS="-nrt -nogui -path .libs"
+PDARGS="-noprefs -nostdpath -nosound -nrt -nogui -path .libs"
+#PDARGS="-nostdpath -nosound -nrt -nogui -path .libs"
+#VALGRIND=valgrind
+VALGRIND="valgrind --error-exitcode=1"
+
+do_runtest() {
+case "$1" in
+ mem*|MEM*)
+ ${VALGRIND} ${PD} ${PDARGS} -lib ${EXTERNAL}
+ ;;
+ DRD|drd)
+ ${VALGRIND} --tool=drd ${PD} ${PDARGS} -lib ${EXTERNAL}
+ ;;
+ HEL*|hel*)
+ ${VALGRIND} --tool=helgrind ${PD} ${PDARGS} -lib ${EXTERNAL}
+ ;;
+ *)
+ ${PD} ${PDARGS} -lib ${EXTERNAL}
+ ;;
+esac
+}
+
+
+#do_runtest
+#do_runtest MEM
+#do_runtest DRD
+#do_runtest HEL
+#do_runtest && do_runtest MEM && do_runtest DRD
+
+do_runtest $TESTTYPE
diff --git a/build/autotests/tests/serialqueue.c b/build/autotests/tests/serialqueue.c
new file mode 100644
index 0000000..238be41
--- /dev/null
+++ b/build/autotests/tests/serialqueue.c
@@ -0,0 +1,58 @@
+#include <common.h>
+
+#include <pthread.h>
+
+#define NUMCHUNKS 1000
+
+
+typedef union {
+ unsigned char cp;
+ int count;
+} data_t;
+static int producer(t_iemnet_queue*q, unsigned int count, unsigned int msec) {
+ unsigned int i;
+ data_t data;
+ for(i=0; i<count; i++) {
+ t_iemnet_chunk*chunk=0;
+ data.count=i;
+ // post("producing %d", i);
+
+ chunk=iemnet__chunk_create_data(sizeof(data), &data.cp);
+ queue_push(q, chunk);
+ usleep(1000*msec);
+ }
+ return 0;
+}
+
+static int consumer(t_iemnet_queue*q) {
+ t_iemnet_chunk*chunk=NULL;
+ while(1) {
+ data_t*data=NULL;
+
+ /* in a non-threaded context, we must not use queue_pop_block()
+ * as we have no way to unblock the queue,
+ * resulting in a deadlock
+ */
+ chunk=queue_pop_noblock(q);
+ if(!chunk)
+ break;
+ if(sizeof(data_t)!=chunk->size) {
+ error("size mismatch %d!=%d", sizeof(data_t), chunk->size);
+ fail();
+ }
+ data=chunk->data;
+ // post("consumed %d", data->count);
+ iemnet__chunk_destroy(chunk);
+ }
+ printf("\n");
+ return 0;
+}
+
+void serialqueue_setup(void) {
+ t_iemnet_queue*q=queue_create();
+ producer(q, 1000, 1);
+ consumer(q);
+
+ queue_destroy(q);
+ pass();
+}
diff --git a/build/autotests/tests/skip.c b/build/autotests/tests/skip.c
new file mode 100644
index 0000000..63775ec
--- /dev/null
+++ b/build/autotests/tests/skip.c
@@ -0,0 +1,5 @@
+#include "common.h"
+
+void skip_setup(void) {
+ skip();
+}
diff --git a/build/autotests/tests/threadedqueue.c b/build/autotests/tests/threadedqueue.c
new file mode 100644
index 0000000..b68f11d
--- /dev/null
+++ b/build/autotests/tests/threadedqueue.c
@@ -0,0 +1,77 @@
+#include <common.h>
+
+#include <pthread.h>
+
+#define NUMCHUNKS 1000
+
+
+typedef union {
+ unsigned char cp;
+ int count;
+} data_t;
+static int producer(t_iemnet_queue*q, unsigned int count, unsigned int msec) {
+ unsigned int i;
+ data_t data;
+ for(i=0; i<count; i++) {
+ t_iemnet_chunk*chunk=0;
+ data.count=i;
+
+ chunk=iemnet__chunk_create_data(sizeof(data), &data.cp);
+ queue_push(q, chunk);
+ usleep(1000*msec);
+ }
+ return 0;
+}
+
+static int consumer(t_iemnet_queue*q) {
+ t_iemnet_chunk*chunk=NULL;
+ while(1) {
+ data_t*data=NULL;
+ chunk=queue_pop_block(q);
+ if(!chunk)
+ break;
+ if(sizeof(data_t)!=chunk->size) {
+ error("size mismatch %d!=%d", sizeof(data_t), chunk->size);
+ fail();
+ }
+ data=chunk->data;
+ //printf("%d ", data->count);
+ iemnet__chunk_destroy(chunk);
+ }
+ printf("\n");
+ return 0;
+}
+static void* consumer_thread(void*qq) {
+ t_iemnet_queue*q=(t_iemnet_queue*)qq;
+ consumer(q);
+ return NULL;
+}
+
+void threadedqueue_setup(void) {
+ pthread_t thread;
+ pthread_attr_t threadattr;
+
+ t_iemnet_queue*q=queue_create();
+
+ /* prepare child thread */
+ if(pthread_attr_init(&threadattr) < 0) {
+ error("warning: could not prepare child thread");
+ fail();
+ }
+ if(pthread_attr_setdetachstate(&threadattr, PTHREAD_CREATE_DETACHED) < 0) {
+ error("warning: could not prepare child thread...");
+ fail();
+ }
+
+ if(pthread_create(&thread, &threadattr, consumer_thread, q) < 0) {
+ error("warning: could not create child thread");
+ fail();
+ }
+
+
+ producer(q, 1000, 1);
+
+
+ queue_destroy(q);
+ pass();
+}
diff --git a/build/coverity/coverity_model.c b/build/coverity/coverity_model.c
new file mode 100644
index 0000000..389fba5
--- /dev/null
+++ b/build/coverity/coverity_model.c
@@ -0,0 +1,21 @@
+/* Coverity Scan model
+ *
+ * This is a modeling file for Coverity Scan. Modeling helps to avoid false
+ * positives.
+ *
+ * - A model file can't import any header files.
+ * - Therefore only some built-in primitives like int, char and void are
+ * available but not wchar_t, NULL etc.
+ * - Modeling doesn't need full structs and typedefs. Rudimentary structs
+ * and similar types are sufficient.
+ * - An uninitialized local pointer is not an error. It signifies that the
+ * variable could be either NULL or have some data.
+ *
+ * Coverity Scan doesn't pick up modifications automatically. The model file
+ * must be uploaded by an admin in the analysis settings of
+ * http://scan.coverity.com/projects/1830
+ */
+
+void sys_closesocket(int fd) {
+ __coverity_close__(fd);
+}
diff --git a/tests/README.txt b/tests/README.txt
new file mode 100644
index 0000000..0f0edf4
--- /dev/null
+++ b/tests/README.txt
@@ -0,0 +1,30 @@
+things that need testing
+========================
+
+all tests should be done with audio on (e.g. testtone)
+
+senders
+-------
+- delete object
+- connect/disconnect
+- send 100MB of data
+-- disconnect
+-- delete object
+- send 100MB of data
+-- delete object
+
+receivers
+---------
+- delete object
+- recv 100MB of data
+-- disconnect
+-- delete object
+- recv 100MB of data
+-- delete object
+
+
+data integrity
+--------------
+repeat data back to sender (or to another receiver, for unidirectional objects)
+is the data consistent?
+(simple test: nc a large file)
diff --git a/tests/bandwidth.pd b/tests/bandwidth.pd
new file mode 100644
index 0000000..0ba1444
--- /dev/null
+++ b/tests/bandwidth.pd
@@ -0,0 +1,43 @@
+#N canvas 5 49 777 582 10;
+#X obj 369 131 metro 1000;
+#X obj 151 249 list length;
+#X obj 414 203 +;
+#X obj 414 227 t f f;
+#X obj 383 256 f;
+#X obj 383 278 t f b;
+#X msg 426 279 0;
+#X obj 385 462 outlet bytes/sec;
+#X obj 385 412 makefilename %dB/s;
+#X obj 444 380 makefilename %dkB/s;
+#X obj 527 431 makefilename %dMB/s;
+#X obj 383 300 moses 1024;
+#X obj 450 328 / 1024;
+#X obj 449 354 moses 1024;
+#X obj 523 407 / 1024;
+#X obj 366 81 loadbang;
+#X obj 371 107 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
+1;
+#X obj 151 225 inlet;
+#X obj 517 113 inlet length;
+#X connect 0 0 4 0;
+#X connect 1 0 2 0;
+#X connect 2 0 3 0;
+#X connect 3 0 4 1;
+#X connect 3 1 2 1;
+#X connect 4 0 5 0;
+#X connect 5 0 11 0;
+#X connect 5 1 6 0;
+#X connect 6 0 3 0;
+#X connect 8 0 7 0;
+#X connect 9 0 7 0;
+#X connect 10 0 7 0;
+#X connect 11 0 8 0;
+#X connect 11 1 12 0;
+#X connect 12 0 13 0;
+#X connect 13 0 9 0;
+#X connect 13 1 14 0;
+#X connect 14 0 10 0;
+#X connect 15 0 16 0;
+#X connect 16 0 0 0;
+#X connect 17 0 1 0;
+#X connect 18 0 2 0;
diff --git a/tests/delete/01_send-and-delete.pd b/tests/delete/01_send-and-delete.pd
new file mode 100644
index 0000000..630b585
--- /dev/null
+++ b/tests/delete/01_send-and-delete.pd
@@ -0,0 +1,11 @@
+#N canvas 529 261 450 300 10;
+#X obj 302 40 udpreceive 9990;
+#X floatatom 302 62 5 0 0 0 - - -, f 5;
+#X obj 304 97 tcpreceive 9990;
+#X floatatom 304 119 5 0 0 0 - - -, f 5;
+#X obj 128 38 test-sender udpsend;
+#X obj 128 58 test-sender udpclient;
+#X obj 128 98 test-sender tcpsend;
+#X obj 128 118 test-sender tcpclient;
+#X connect 0 0 1 0;
+#X connect 2 0 3 0;
diff --git a/tests/delete/test-sender.pd b/tests/delete/test-sender.pd
new file mode 100644
index 0000000..a3cad44
--- /dev/null
+++ b/tests/delete/test-sender.pd
@@ -0,0 +1,693 @@
+#N canvas 488 98 645 576 10;
+#X text 28 37 1 delete object:;
+#X text 32 99 2a connect;
+#X text 32 114 2b disconnect;
+#X text 32 128 2c delete;
+#X text 32 189 3a connect;
+#X text 32 204 3b delete;
+#X text 32 279 4a connect;
+#X text 32 295 4b send;
+#X text 32 314 4c disconnect;
+#X text 32 328 4d delete;
+#X text 32 409 5a connect;
+#X text 32 425 5b send;
+#X text 32 442 5c delete;
+#X msg 231 93 connect;
+#X msg 231 115 disconnect;
+#X msg 231 137 delete;
+#X msg 343 123 auto;
+#X msg 231 37 delete;
+#X msg 343 23 auto;
+#N canvas 11 49 679 407 test1 0;
+#X msg 101 166 connect localhost 9990;
+#X msg 265 166 disconnect;
+#X obj 25 7 inlet;
+#X obj 25 29 symbol;
+#X msg 399 219 clear;
+#X obj 25 51 select auto;
+#X obj 430 304 outlet;
+#X msg 538 269 0;
+#X obj 430 27 t b b;
+#X obj 430 49 t b b;
+#X obj 430 71 del 500;
+#X obj 430 93 t b b;
+#X obj 430 115 del 500;
+#X obj 430 187 t b b;
+#X msg 430 274 1;
+#N canvas 5 49 450 300 \$0-test1 0;
+#X obj 86 168 \$1;
+#X obj 86 54 inlet;
+#X connect 1 0 0 0;
+#X restore 117 345 pd \$0-test1;
+#X obj 99 101 select connect disconnect delete send;
+#N canvas 4 76 273 340 data 0;
+#X obj 49 35 inlet;
+#X obj 49 237 outlet;
+#N canvas 4 50 768 716 list-1024 0;
+#X msg 59 72 95 215 228 123 188 109 199 205 213 154 157 77 220 89 23
+16 126 102 122 38 90 249 162 222 131 129 247 249 251 101 113 239 42
+184 139 34 95 254 71 35 77 226 36 230 129 242 31 3 228 94 170 242 50
+179 174 67 124 149 127 223 157 127 224 62 189 121 251 171 198 220 93
+120 231 5 242 64 11 25 3 30 86 188 48 239 161 208 108 136 250 44 249
+245 24 96 103 180 223 105 140 244 216 116 129 203 171 147 159 122 161
+128 123 159 27 82 226 124 15 63 211 43 133 86 126 219 20 56 62 16 90
+216 149 221 124 55 42 29 160 28 194 180 108 213 62 199 124 238 152
+249 227 241 219 171 166 34 37 49 55 54 155 18 242 21 110 70 153 148
+207 108 206 47 242 13 146 200 3 211 191 96 41 198 132 213 124 137 227
+159 4 150 42 137 182 121 113 112 110 14 24 251 233 185 60 92 199 166
+59 8 131 4 44 119 110 65 90 218 173 67 195 222 53 170 147 98 200 5
+158 55 236 20 223 218 238 1 241 49 217 157 143 70 116 154 10 3 60 203
+204 240 101 90 207 238 206 12 27 240 6 117 64 188 65 57 215 162 87
+70 246 63 191 18 181 47 142 212 162 211 109 194 67 7 156 77 142 222
+231 92 105 98 170 136 31 76 196 91 230 195 154 134 81 21 17 36 212
+117 137 241 58 183 216 135 37 13 73 155 136 189 152 57 35 231 233 255
+2 56 204 90 244 170 48 194 11 66 102 244 20 198 27 49 26 127 83 120
+218 242 100 195 67 156 247 66 243 176 253 152 177 207 176 22 233 201
+143 247 42 86 85 160 157 210 253 211 137 250 183 246 201 166 229 70
+72 138 29 24 127 235 28 19 243 97 201 110 173 143 47 39 182 225 119
+72 150 73 231 24 208 246 218 96 90 25 195 163 29 150 32 90 111 201
+125 48 144 61 110 65 38 106 136 81 182 114 98 11 39 217 142 61 53 69
+150 21 245 57 245 89 75 207 25 167 106 120 89 175 79 178 245 112 60
+203 17 115 51 152 174 9 119 51 172 132 0 181 192 117 0 247 115 232
+89 70 30 158 24 40 231 77 248 17 184 217 215 33 66 142 52 227 243 98
+173 6 247 43 121 22 48 223 228 65 52 207 206 10 72 224 33 9 94 204
+83 168 13 92 222 220 146 161 192 227 200 52 241 1 40 114 230 56 191
+179 9 8 49 141 50 42 174 11 43 74 245 235 38 199 75 217 57 107 120
+172 222 39 197 161 107 212 245 152 145 233 67 81 212 58 95 163 12 181
+103 192 223 27 229 105 57 190 203 47 207 61 109 173 150 62 128 198
+66 46 22 221 191 249 148 23 174 200 184 144 229 188 139 157 227 171
+101 5 84 220 227 61 136 194 231 165 240 185 147 195 158 192 66 129
+184 57 138 102 255 161 50 211 66 78 50 67 223 42 172 128 62 113 236
+228 74 106 95 147 244 37 147 185 165 56 50 194 197 119 251 156 46 180
+197 236 173 121 114 80 124 199 242 152 191 204 60 2 255 164 75 119
+167 20 25 198 128 70 156 225 44 130 193 26 162 240 104 90 172 79 99
+101 96 178 110 14 158 60 44 119 141 223 35 79 19 20 188 10 87 153 56
+29 53 43 177 62 196 70 20 157 199 222 30 32 50 25 88 160 163 18 18
+35 219 140 96 28 63 182 20 164 80 225 190 181 40 65 163 105 249 165
+190 53 133 53 185 34 155 46 231 14 149 156 71 229 210 25 119 222 50
+135 184 181 146 206 228 233 76 148 112 250 171 253 96 160 110 101 75
+9 66 31 83 24 60 42 33 157 88 246 225 146 243 25 63 90 71 14 99 249
+232 242 237 80 64 59 240 94 10 125 237 117 206 27 212 125 96 12 248
+41 86 147 21 58 139 250 65 181 148 82 243 35 68 43 244 203 32 82 102
+239 223 140 182 6 231 82 160 252 199 145 37 106 178 94 138 212 0 186
+86 228 163 73 74 168 168 16 92 202 178 47 185 210 118 161 189 92 52
+245 239 86 57 9 253 64 85 201 185 96 90 233 22 8 153 163 31 199 91
+110 251 174 95 194 226 135 85 205 26 21 93 49 249 74 126 194 217 136
+37 65 25 222 161 22 22 62 159 14 44 191 164 23 170 212 140 251 214
+142 5 30 229 209 10 55 246 150 93 14 17 36 10 55 33 77 220 208 240
+168 219 59 38 208 203 217 64 157 163 202 143 101 13 165 52 48 225 54
+28 251 158 58 251 243 236 26 72 172 19 167 59 100 119 216 198 57 24
+132 148 105 10 29 3 140 245 113 32 209 138 94 164 57;
+#X obj 65 28 inlet;
+#X obj 113 26 outlet;
+#X connect 0 0 2 0;
+#X connect 1 0 0 0;
+#X restore 49 179 pd list-1024;
+#X obj 49 150 until;
+#X msg 49 125 1024;
+#X obj 49 100 until;
+#X msg 49 75 100;
+#X connect 0 0 6 0;
+#X connect 2 0 1 0;
+#X connect 3 0 2 0;
+#X connect 4 0 3 0;
+#X connect 5 0 4 0;
+#X connect 6 0 5 0;
+#X restore 275 209 pd data;
+#X obj 430 140 t b b;
+#X obj 430 162 del 500;
+#X obj 397 240 s pd-\$0-test1;
+#X connect 0 0 15 0;
+#X connect 1 0 15 0;
+#X connect 2 0 3 0;
+#X connect 3 0 5 0;
+#X connect 4 0 20 0;
+#X connect 5 0 8 0;
+#X connect 5 1 16 0;
+#X connect 7 0 6 0;
+#X connect 8 0 9 0;
+#X connect 8 1 7 0;
+#X connect 9 0 10 0;
+#X connect 10 0 11 0;
+#X connect 11 0 12 0;
+#X connect 12 0 18 0;
+#X connect 13 0 14 0;
+#X connect 13 1 4 0;
+#X connect 14 0 6 0;
+#X connect 16 0 0 0;
+#X connect 16 1 1 0;
+#X connect 16 2 4 0;
+#X connect 16 3 17 0;
+#X connect 17 0 15 0;
+#X connect 18 0 19 0;
+#X connect 19 0 13 0;
+#X restore 231 59 pd test1;
+#X obj 297 60 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X obj 301 160 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#N canvas 12 50 679 407 test2 0;
+#X msg 101 166 connect localhost 9990;
+#X msg 265 166 disconnect;
+#X obj 25 7 inlet;
+#X obj 25 29 symbol;
+#X msg 399 219 clear;
+#X obj 25 51 select auto;
+#X obj 430 304 outlet;
+#X msg 538 269 0;
+#X obj 430 27 t b b;
+#X obj 430 49 t b b;
+#X obj 430 71 del 500;
+#X obj 430 93 t b b;
+#X obj 430 115 del 500;
+#X obj 430 187 t b b;
+#X msg 430 274 1;
+#X obj 99 101 select connect disconnect delete send;
+#N canvas 4 76 273 340 data 0;
+#X obj 49 35 inlet;
+#X obj 49 237 outlet;
+#N canvas 4 50 768 716 list-1024 0;
+#X msg 59 72 95 215 228 123 188 109 199 205 213 154 157 77 220 89 23
+16 126 102 122 38 90 249 162 222 131 129 247 249 251 101 113 239 42
+184 139 34 95 254 71 35 77 226 36 230 129 242 31 3 228 94 170 242 50
+179 174 67 124 149 127 223 157 127 224 62 189 121 251 171 198 220 93
+120 231 5 242 64 11 25 3 30 86 188 48 239 161 208 108 136 250 44 249
+245 24 96 103 180 223 105 140 244 216 116 129 203 171 147 159 122 161
+128 123 159 27 82 226 124 15 63 211 43 133 86 126 219 20 56 62 16 90
+216 149 221 124 55 42 29 160 28 194 180 108 213 62 199 124 238 152
+249 227 241 219 171 166 34 37 49 55 54 155 18 242 21 110 70 153 148
+207 108 206 47 242 13 146 200 3 211 191 96 41 198 132 213 124 137 227
+159 4 150 42 137 182 121 113 112 110 14 24 251 233 185 60 92 199 166
+59 8 131 4 44 119 110 65 90 218 173 67 195 222 53 170 147 98 200 5
+158 55 236 20 223 218 238 1 241 49 217 157 143 70 116 154 10 3 60 203
+204 240 101 90 207 238 206 12 27 240 6 117 64 188 65 57 215 162 87
+70 246 63 191 18 181 47 142 212 162 211 109 194 67 7 156 77 142 222
+231 92 105 98 170 136 31 76 196 91 230 195 154 134 81 21 17 36 212
+117 137 241 58 183 216 135 37 13 73 155 136 189 152 57 35 231 233 255
+2 56 204 90 244 170 48 194 11 66 102 244 20 198 27 49 26 127 83 120
+218 242 100 195 67 156 247 66 243 176 253 152 177 207 176 22 233 201
+143 247 42 86 85 160 157 210 253 211 137 250 183 246 201 166 229 70
+72 138 29 24 127 235 28 19 243 97 201 110 173 143 47 39 182 225 119
+72 150 73 231 24 208 246 218 96 90 25 195 163 29 150 32 90 111 201
+125 48 144 61 110 65 38 106 136 81 182 114 98 11 39 217 142 61 53 69
+150 21 245 57 245 89 75 207 25 167 106 120 89 175 79 178 245 112 60
+203 17 115 51 152 174 9 119 51 172 132 0 181 192 117 0 247 115 232
+89 70 30 158 24 40 231 77 248 17 184 217 215 33 66 142 52 227 243 98
+173 6 247 43 121 22 48 223 228 65 52 207 206 10 72 224 33 9 94 204
+83 168 13 92 222 220 146 161 192 227 200 52 241 1 40 114 230 56 191
+179 9 8 49 141 50 42 174 11 43 74 245 235 38 199 75 217 57 107 120
+172 222 39 197 161 107 212 245 152 145 233 67 81 212 58 95 163 12 181
+103 192 223 27 229 105 57 190 203 47 207 61 109 173 150 62 128 198
+66 46 22 221 191 249 148 23 174 200 184 144 229 188 139 157 227 171
+101 5 84 220 227 61 136 194 231 165 240 185 147 195 158 192 66 129
+184 57 138 102 255 161 50 211 66 78 50 67 223 42 172 128 62 113 236
+228 74 106 95 147 244 37 147 185 165 56 50 194 197 119 251 156 46 180
+197 236 173 121 114 80 124 199 242 152 191 204 60 2 255 164 75 119
+167 20 25 198 128 70 156 225 44 130 193 26 162 240 104 90 172 79 99
+101 96 178 110 14 158 60 44 119 141 223 35 79 19 20 188 10 87 153 56
+29 53 43 177 62 196 70 20 157 199 222 30 32 50 25 88 160 163 18 18
+35 219 140 96 28 63 182 20 164 80 225 190 181 40 65 163 105 249 165
+190 53 133 53 185 34 155 46 231 14 149 156 71 229 210 25 119 222 50
+135 184 181 146 206 228 233 76 148 112 250 171 253 96 160 110 101 75
+9 66 31 83 24 60 42 33 157 88 246 225 146 243 25 63 90 71 14 99 249
+232 242 237 80 64 59 240 94 10 125 237 117 206 27 212 125 96 12 248
+41 86 147 21 58 139 250 65 181 148 82 243 35 68 43 244 203 32 82 102
+239 223 140 182 6 231 82 160 252 199 145 37 106 178 94 138 212 0 186
+86 228 163 73 74 168 168 16 92 202 178 47 185 210 118 161 189 92 52
+245 239 86 57 9 253 64 85 201 185 96 90 233 22 8 153 163 31 199 91
+110 251 174 95 194 226 135 85 205 26 21 93 49 249 74 126 194 217 136
+37 65 25 222 161 22 22 62 159 14 44 191 164 23 170 212 140 251 214
+142 5 30 229 209 10 55 246 150 93 14 17 36 10 55 33 77 220 208 240
+168 219 59 38 208 203 217 64 157 163 202 143 101 13 165 52 48 225 54
+28 251 158 58 251 243 236 26 72 172 19 167 59 100 119 216 198 57 24
+132 148 105 10 29 3 140 245 113 32 209 138 94 164 57;
+#X obj 65 28 inlet;
+#X obj 113 26 outlet;
+#X connect 0 0 2 0;
+#X connect 1 0 0 0;
+#X restore 49 179 pd list-1024;
+#X obj 49 150 until;
+#X msg 49 125 1024;
+#X obj 49 100 until;
+#X msg 49 75 100;
+#X connect 0 0 6 0;
+#X connect 2 0 1 0;
+#X connect 3 0 2 0;
+#X connect 4 0 3 0;
+#X connect 5 0 4 0;
+#X connect 6 0 5 0;
+#X restore 275 209 pd data;
+#X obj 430 140 t b b;
+#X obj 430 162 del 500;
+#N canvas 4 50 450 300 \$0-test2 0;
+#X obj 86 168 \$1;
+#X obj 86 54 inlet;
+#X connect 1 0 0 0;
+#X restore 118 346 pd \$0-test2;
+#X obj 397 240 s pd-\$0-test2;
+#X connect 0 0 19 0;
+#X connect 1 0 19 0;
+#X connect 2 0 3 0;
+#X connect 3 0 5 0;
+#X connect 4 0 20 0;
+#X connect 5 0 8 0;
+#X connect 5 1 15 0;
+#X connect 7 0 6 0;
+#X connect 8 0 9 0;
+#X connect 8 1 7 0;
+#X connect 9 0 10 0;
+#X connect 9 1 0 0;
+#X connect 10 0 11 0;
+#X connect 11 0 12 0;
+#X connect 12 0 17 0;
+#X connect 13 0 14 0;
+#X connect 13 1 4 0;
+#X connect 14 0 6 0;
+#X connect 15 0 0 0;
+#X connect 15 1 1 0;
+#X connect 15 2 4 0;
+#X connect 15 3 16 0;
+#X connect 16 0 19 0;
+#X connect 17 0 18 0;
+#X connect 17 1 1 0;
+#X connect 18 0 13 0;
+#X restore 231 159 pd test2;
+#X msg 231 193 connect;
+#X msg 231 217 delete;
+#X msg 343 203 auto;
+#X obj 301 240 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#N canvas 13 50 679 407 test3 0;
+#X msg 101 166 connect localhost 9990;
+#X msg 265 166 disconnect;
+#X obj 25 7 inlet;
+#X obj 25 29 symbol;
+#X msg 399 219 clear;
+#X obj 25 51 select auto;
+#X obj 430 304 outlet;
+#X msg 538 269 0;
+#X obj 430 27 t b b;
+#X obj 430 49 t b b;
+#X obj 430 71 del 500;
+#X obj 430 93 t b b;
+#X obj 430 115 del 500;
+#X obj 430 187 t b b;
+#X msg 430 274 1;
+#X obj 99 101 select connect disconnect delete send;
+#N canvas 4 76 273 340 data 0;
+#X obj 49 35 inlet;
+#X obj 49 237 outlet;
+#N canvas 4 50 768 716 list-1024 0;
+#X msg 59 72 95 215 228 123 188 109 199 205 213 154 157 77 220 89 23
+16 126 102 122 38 90 249 162 222 131 129 247 249 251 101 113 239 42
+184 139 34 95 254 71 35 77 226 36 230 129 242 31 3 228 94 170 242 50
+179 174 67 124 149 127 223 157 127 224 62 189 121 251 171 198 220 93
+120 231 5 242 64 11 25 3 30 86 188 48 239 161 208 108 136 250 44 249
+245 24 96 103 180 223 105 140 244 216 116 129 203 171 147 159 122 161
+128 123 159 27 82 226 124 15 63 211 43 133 86 126 219 20 56 62 16 90
+216 149 221 124 55 42 29 160 28 194 180 108 213 62 199 124 238 152
+249 227 241 219 171 166 34 37 49 55 54 155 18 242 21 110 70 153 148
+207 108 206 47 242 13 146 200 3 211 191 96 41 198 132 213 124 137 227
+159 4 150 42 137 182 121 113 112 110 14 24 251 233 185 60 92 199 166
+59 8 131 4 44 119 110 65 90 218 173 67 195 222 53 170 147 98 200 5
+158 55 236 20 223 218 238 1 241 49 217 157 143 70 116 154 10 3 60 203
+204 240 101 90 207 238 206 12 27 240 6 117 64 188 65 57 215 162 87
+70 246 63 191 18 181 47 142 212 162 211 109 194 67 7 156 77 142 222
+231 92 105 98 170 136 31 76 196 91 230 195 154 134 81 21 17 36 212
+117 137 241 58 183 216 135 37 13 73 155 136 189 152 57 35 231 233 255
+2 56 204 90 244 170 48 194 11 66 102 244 20 198 27 49 26 127 83 120
+218 242 100 195 67 156 247 66 243 176 253 152 177 207 176 22 233 201
+143 247 42 86 85 160 157 210 253 211 137 250 183 246 201 166 229 70
+72 138 29 24 127 235 28 19 243 97 201 110 173 143 47 39 182 225 119
+72 150 73 231 24 208 246 218 96 90 25 195 163 29 150 32 90 111 201
+125 48 144 61 110 65 38 106 136 81 182 114 98 11 39 217 142 61 53 69
+150 21 245 57 245 89 75 207 25 167 106 120 89 175 79 178 245 112 60
+203 17 115 51 152 174 9 119 51 172 132 0 181 192 117 0 247 115 232
+89 70 30 158 24 40 231 77 248 17 184 217 215 33 66 142 52 227 243 98
+173 6 247 43 121 22 48 223 228 65 52 207 206 10 72 224 33 9 94 204
+83 168 13 92 222 220 146 161 192 227 200 52 241 1 40 114 230 56 191
+179 9 8 49 141 50 42 174 11 43 74 245 235 38 199 75 217 57 107 120
+172 222 39 197 161 107 212 245 152 145 233 67 81 212 58 95 163 12 181
+103 192 223 27 229 105 57 190 203 47 207 61 109 173 150 62 128 198
+66 46 22 221 191 249 148 23 174 200 184 144 229 188 139 157 227 171
+101 5 84 220 227 61 136 194 231 165 240 185 147 195 158 192 66 129
+184 57 138 102 255 161 50 211 66 78 50 67 223 42 172 128 62 113 236
+228 74 106 95 147 244 37 147 185 165 56 50 194 197 119 251 156 46 180
+197 236 173 121 114 80 124 199 242 152 191 204 60 2 255 164 75 119
+167 20 25 198 128 70 156 225 44 130 193 26 162 240 104 90 172 79 99
+101 96 178 110 14 158 60 44 119 141 223 35 79 19 20 188 10 87 153 56
+29 53 43 177 62 196 70 20 157 199 222 30 32 50 25 88 160 163 18 18
+35 219 140 96 28 63 182 20 164 80 225 190 181 40 65 163 105 249 165
+190 53 133 53 185 34 155 46 231 14 149 156 71 229 210 25 119 222 50
+135 184 181 146 206 228 233 76 148 112 250 171 253 96 160 110 101 75
+9 66 31 83 24 60 42 33 157 88 246 225 146 243 25 63 90 71 14 99 249
+232 242 237 80 64 59 240 94 10 125 237 117 206 27 212 125 96 12 248
+41 86 147 21 58 139 250 65 181 148 82 243 35 68 43 244 203 32 82 102
+239 223 140 182 6 231 82 160 252 199 145 37 106 178 94 138 212 0 186
+86 228 163 73 74 168 168 16 92 202 178 47 185 210 118 161 189 92 52
+245 239 86 57 9 253 64 85 201 185 96 90 233 22 8 153 163 31 199 91
+110 251 174 95 194 226 135 85 205 26 21 93 49 249 74 126 194 217 136
+37 65 25 222 161 22 22 62 159 14 44 191 164 23 170 212 140 251 214
+142 5 30 229 209 10 55 246 150 93 14 17 36 10 55 33 77 220 208 240
+168 219 59 38 208 203 217 64 157 163 202 143 101 13 165 52 48 225 54
+28 251 158 58 251 243 236 26 72 172 19 167 59 100 119 216 198 57 24
+132 148 105 10 29 3 140 245 113 32 209 138 94 164 57;
+#X obj 65 28 inlet;
+#X obj 113 26 outlet;
+#X connect 0 0 2 0;
+#X connect 1 0 0 0;
+#X restore 49 179 pd list-1024;
+#X obj 49 150 until;
+#X msg 49 125 1024;
+#X obj 49 100 until;
+#X msg 49 75 100;
+#X connect 0 0 6 0;
+#X connect 2 0 1 0;
+#X connect 3 0 2 0;
+#X connect 4 0 3 0;
+#X connect 5 0 4 0;
+#X connect 6 0 5 0;
+#X restore 275 209 pd data;
+#X obj 430 140 t b b;
+#X obj 430 162 del 500;
+#N canvas 4 50 450 300 \$0-test3 0;
+#X obj 86 168 \$1;
+#X obj 86 54 inlet;
+#X connect 1 0 0 0;
+#X restore 118 346 pd \$0-test3;
+#X obj 397 240 s pd-\$0-test3;
+#X connect 0 0 19 0;
+#X connect 1 0 19 0;
+#X connect 2 0 3 0;
+#X connect 3 0 5 0;
+#X connect 4 0 20 0;
+#X connect 5 0 8 0;
+#X connect 5 1 15 0;
+#X connect 7 0 6 0;
+#X connect 8 0 9 0;
+#X connect 8 1 7 0;
+#X connect 9 0 10 0;
+#X connect 9 1 0 0;
+#X connect 10 0 11 0;
+#X connect 11 0 12 0;
+#X connect 12 0 17 0;
+#X connect 13 0 14 0;
+#X connect 13 1 4 0;
+#X connect 14 0 6 0;
+#X connect 15 0 0 0;
+#X connect 15 1 1 0;
+#X connect 15 2 4 0;
+#X connect 15 3 16 0;
+#X connect 16 0 19 0;
+#X connect 17 0 18 0;
+#X connect 18 0 13 0;
+#X restore 231 239 pd test3;
+#X msg 231 273 connect;
+#X msg 231 315 disconnect;
+#X msg 231 337 delete;
+#X msg 343 323 auto;
+#X obj 301 360 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X msg 231 294 send;
+#N canvas 11 50 679 407 test4 0;
+#X msg 101 166 connect localhost 9990;
+#X msg 265 166 disconnect;
+#X obj 25 7 inlet;
+#X obj 25 29 symbol;
+#X msg 399 219 clear;
+#X obj 25 51 select auto;
+#X obj 430 304 outlet;
+#X msg 538 269 0;
+#X obj 430 27 t b b;
+#X obj 430 49 t b b;
+#X obj 430 71 del 500;
+#X obj 430 93 t b b;
+#X obj 430 115 del 500;
+#X obj 430 187 t b b;
+#X msg 430 274 1;
+#X obj 99 101 select connect disconnect delete send;
+#N canvas 4 76 273 340 data 0;
+#X obj 49 35 inlet;
+#X obj 49 237 outlet;
+#N canvas 4 50 768 716 list-1024 0;
+#X msg 59 72 95 215 228 123 188 109 199 205 213 154 157 77 220 89 23
+16 126 102 122 38 90 249 162 222 131 129 247 249 251 101 113 239 42
+184 139 34 95 254 71 35 77 226 36 230 129 242 31 3 228 94 170 242 50
+179 174 67 124 149 127 223 157 127 224 62 189 121 251 171 198 220 93
+120 231 5 242 64 11 25 3 30 86 188 48 239 161 208 108 136 250 44 249
+245 24 96 103 180 223 105 140 244 216 116 129 203 171 147 159 122 161
+128 123 159 27 82 226 124 15 63 211 43 133 86 126 219 20 56 62 16 90
+216 149 221 124 55 42 29 160 28 194 180 108 213 62 199 124 238 152
+249 227 241 219 171 166 34 37 49 55 54 155 18 242 21 110 70 153 148
+207 108 206 47 242 13 146 200 3 211 191 96 41 198 132 213 124 137 227
+159 4 150 42 137 182 121 113 112 110 14 24 251 233 185 60 92 199 166
+59 8 131 4 44 119 110 65 90 218 173 67 195 222 53 170 147 98 200 5
+158 55 236 20 223 218 238 1 241 49 217 157 143 70 116 154 10 3 60 203
+204 240 101 90 207 238 206 12 27 240 6 117 64 188 65 57 215 162 87
+70 246 63 191 18 181 47 142 212 162 211 109 194 67 7 156 77 142 222
+231 92 105 98 170 136 31 76 196 91 230 195 154 134 81 21 17 36 212
+117 137 241 58 183 216 135 37 13 73 155 136 189 152 57 35 231 233 255
+2 56 204 90 244 170 48 194 11 66 102 244 20 198 27 49 26 127 83 120
+218 242 100 195 67 156 247 66 243 176 253 152 177 207 176 22 233 201
+143 247 42 86 85 160 157 210 253 211 137 250 183 246 201 166 229 70
+72 138 29 24 127 235 28 19 243 97 201 110 173 143 47 39 182 225 119
+72 150 73 231 24 208 246 218 96 90 25 195 163 29 150 32 90 111 201
+125 48 144 61 110 65 38 106 136 81 182 114 98 11 39 217 142 61 53 69
+150 21 245 57 245 89 75 207 25 167 106 120 89 175 79 178 245 112 60
+203 17 115 51 152 174 9 119 51 172 132 0 181 192 117 0 247 115 232
+89 70 30 158 24 40 231 77 248 17 184 217 215 33 66 142 52 227 243 98
+173 6 247 43 121 22 48 223 228 65 52 207 206 10 72 224 33 9 94 204
+83 168 13 92 222 220 146 161 192 227 200 52 241 1 40 114 230 56 191
+179 9 8 49 141 50 42 174 11 43 74 245 235 38 199 75 217 57 107 120
+172 222 39 197 161 107 212 245 152 145 233 67 81 212 58 95 163 12 181
+103 192 223 27 229 105 57 190 203 47 207 61 109 173 150 62 128 198
+66 46 22 221 191 249 148 23 174 200 184 144 229 188 139 157 227 171
+101 5 84 220 227 61 136 194 231 165 240 185 147 195 158 192 66 129
+184 57 138 102 255 161 50 211 66 78 50 67 223 42 172 128 62 113 236
+228 74 106 95 147 244 37 147 185 165 56 50 194 197 119 251 156 46 180
+197 236 173 121 114 80 124 199 242 152 191 204 60 2 255 164 75 119
+167 20 25 198 128 70 156 225 44 130 193 26 162 240 104 90 172 79 99
+101 96 178 110 14 158 60 44 119 141 223 35 79 19 20 188 10 87 153 56
+29 53 43 177 62 196 70 20 157 199 222 30 32 50 25 88 160 163 18 18
+35 219 140 96 28 63 182 20 164 80 225 190 181 40 65 163 105 249 165
+190 53 133 53 185 34 155 46 231 14 149 156 71 229 210 25 119 222 50
+135 184 181 146 206 228 233 76 148 112 250 171 253 96 160 110 101 75
+9 66 31 83 24 60 42 33 157 88 246 225 146 243 25 63 90 71 14 99 249
+232 242 237 80 64 59 240 94 10 125 237 117 206 27 212 125 96 12 248
+41 86 147 21 58 139 250 65 181 148 82 243 35 68 43 244 203 32 82 102
+239 223 140 182 6 231 82 160 252 199 145 37 106 178 94 138 212 0 186
+86 228 163 73 74 168 168 16 92 202 178 47 185 210 118 161 189 92 52
+245 239 86 57 9 253 64 85 201 185 96 90 233 22 8 153 163 31 199 91
+110 251 174 95 194 226 135 85 205 26 21 93 49 249 74 126 194 217 136
+37 65 25 222 161 22 22 62 159 14 44 191 164 23 170 212 140 251 214
+142 5 30 229 209 10 55 246 150 93 14 17 36 10 55 33 77 220 208 240
+168 219 59 38 208 203 217 64 157 163 202 143 101 13 165 52 48 225 54
+28 251 158 58 251 243 236 26 72 172 19 167 59 100 119 216 198 57 24
+132 148 105 10 29 3 140 245 113 32 209 138 94 164 57;
+#X obj 65 28 inlet;
+#X obj 113 26 outlet;
+#X connect 0 0 2 0;
+#X connect 1 0 0 0;
+#X restore 49 179 pd list-1024;
+#X obj 49 150 until;
+#X msg 49 125 1024;
+#X obj 49 100 until;
+#X msg 49 75 100;
+#X connect 0 0 6 0;
+#X connect 2 0 1 0;
+#X connect 3 0 2 0;
+#X connect 4 0 3 0;
+#X connect 5 0 4 0;
+#X connect 6 0 5 0;
+#X restore 275 209 pd data;
+#X obj 430 140 t b b;
+#X obj 430 162 del 500;
+#N canvas 4 50 450 300 \$0-test4 0;
+#X obj 86 168 \$1;
+#X obj 86 54 inlet;
+#X connect 1 0 0 0;
+#X restore 118 346 pd \$0-test4;
+#X obj 397 240 s pd-\$0-test4;
+#X connect 0 0 19 0;
+#X connect 1 0 19 0;
+#X connect 2 0 3 0;
+#X connect 3 0 5 0;
+#X connect 4 0 20 0;
+#X connect 5 0 8 0;
+#X connect 5 1 15 0;
+#X connect 7 0 6 0;
+#X connect 8 0 9 0;
+#X connect 8 1 7 0;
+#X connect 9 0 10 0;
+#X connect 9 1 0 0;
+#X connect 10 0 11 0;
+#X connect 11 0 12 0;
+#X connect 11 1 16 0;
+#X connect 12 0 17 0;
+#X connect 13 0 14 0;
+#X connect 13 1 4 0;
+#X connect 14 0 6 0;
+#X connect 15 0 0 0;
+#X connect 15 1 1 0;
+#X connect 15 2 4 0;
+#X connect 15 3 16 0;
+#X connect 16 0 19 0;
+#X connect 17 0 18 0;
+#X connect 17 1 1 0;
+#X connect 18 0 13 0;
+#X restore 231 359 pd test4;
+#X msg 231 403 connect;
+#X msg 231 467 delete;
+#X msg 343 453 auto;
+#X obj 301 490 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X msg 231 424 send;
+#N canvas 14 49 679 407 test5 0;
+#X msg 101 166 connect localhost 9990;
+#X msg 265 166 disconnect;
+#X obj 25 7 inlet;
+#X obj 25 29 symbol;
+#X msg 399 219 clear;
+#X obj 25 51 select auto;
+#X obj 430 304 outlet;
+#X msg 538 269 0;
+#X obj 430 27 t b b;
+#X obj 430 49 t b b;
+#X obj 430 71 del 500;
+#X obj 430 93 t b b;
+#X obj 430 115 del 500;
+#X obj 430 187 t b b;
+#X msg 430 274 1;
+#X obj 99 101 select connect disconnect delete send;
+#N canvas 4 76 273 340 data 0;
+#X obj 49 35 inlet;
+#X obj 49 237 outlet;
+#N canvas 4 50 768 716 list-1024 0;
+#X msg 59 72 95 215 228 123 188 109 199 205 213 154 157 77 220 89 23
+16 126 102 122 38 90 249 162 222 131 129 247 249 251 101 113 239 42
+184 139 34 95 254 71 35 77 226 36 230 129 242 31 3 228 94 170 242 50
+179 174 67 124 149 127 223 157 127 224 62 189 121 251 171 198 220 93
+120 231 5 242 64 11 25 3 30 86 188 48 239 161 208 108 136 250 44 249
+245 24 96 103 180 223 105 140 244 216 116 129 203 171 147 159 122 161
+128 123 159 27 82 226 124 15 63 211 43 133 86 126 219 20 56 62 16 90
+216 149 221 124 55 42 29 160 28 194 180 108 213 62 199 124 238 152
+249 227 241 219 171 166 34 37 49 55 54 155 18 242 21 110 70 153 148
+207 108 206 47 242 13 146 200 3 211 191 96 41 198 132 213 124 137 227
+159 4 150 42 137 182 121 113 112 110 14 24 251 233 185 60 92 199 166
+59 8 131 4 44 119 110 65 90 218 173 67 195 222 53 170 147 98 200 5
+158 55 236 20 223 218 238 1 241 49 217 157 143 70 116 154 10 3 60 203
+204 240 101 90 207 238 206 12 27 240 6 117 64 188 65 57 215 162 87
+70 246 63 191 18 181 47 142 212 162 211 109 194 67 7 156 77 142 222
+231 92 105 98 170 136 31 76 196 91 230 195 154 134 81 21 17 36 212
+117 137 241 58 183 216 135 37 13 73 155 136 189 152 57 35 231 233 255
+2 56 204 90 244 170 48 194 11 66 102 244 20 198 27 49 26 127 83 120
+218 242 100 195 67 156 247 66 243 176 253 152 177 207 176 22 233 201
+143 247 42 86 85 160 157 210 253 211 137 250 183 246 201 166 229 70
+72 138 29 24 127 235 28 19 243 97 201 110 173 143 47 39 182 225 119
+72 150 73 231 24 208 246 218 96 90 25 195 163 29 150 32 90 111 201
+125 48 144 61 110 65 38 106 136 81 182 114 98 11 39 217 142 61 53 69
+150 21 245 57 245 89 75 207 25 167 106 120 89 175 79 178 245 112 60
+203 17 115 51 152 174 9 119 51 172 132 0 181 192 117 0 247 115 232
+89 70 30 158 24 40 231 77 248 17 184 217 215 33 66 142 52 227 243 98
+173 6 247 43 121 22 48 223 228 65 52 207 206 10 72 224 33 9 94 204
+83 168 13 92 222 220 146 161 192 227 200 52 241 1 40 114 230 56 191
+179 9 8 49 141 50 42 174 11 43 74 245 235 38 199 75 217 57 107 120
+172 222 39 197 161 107 212 245 152 145 233 67 81 212 58 95 163 12 181
+103 192 223 27 229 105 57 190 203 47 207 61 109 173 150 62 128 198
+66 46 22 221 191 249 148 23 174 200 184 144 229 188 139 157 227 171
+101 5 84 220 227 61 136 194 231 165 240 185 147 195 158 192 66 129
+184 57 138 102 255 161 50 211 66 78 50 67 223 42 172 128 62 113 236
+228 74 106 95 147 244 37 147 185 165 56 50 194 197 119 251 156 46 180
+197 236 173 121 114 80 124 199 242 152 191 204 60 2 255 164 75 119
+167 20 25 198 128 70 156 225 44 130 193 26 162 240 104 90 172 79 99
+101 96 178 110 14 158 60 44 119 141 223 35 79 19 20 188 10 87 153 56
+29 53 43 177 62 196 70 20 157 199 222 30 32 50 25 88 160 163 18 18
+35 219 140 96 28 63 182 20 164 80 225 190 181 40 65 163 105 249 165
+190 53 133 53 185 34 155 46 231 14 149 156 71 229 210 25 119 222 50
+135 184 181 146 206 228 233 76 148 112 250 171 253 96 160 110 101 75
+9 66 31 83 24 60 42 33 157 88 246 225 146 243 25 63 90 71 14 99 249
+232 242 237 80 64 59 240 94 10 125 237 117 206 27 212 125 96 12 248
+41 86 147 21 58 139 250 65 181 148 82 243 35 68 43 244 203 32 82 102
+239 223 140 182 6 231 82 160 252 199 145 37 106 178 94 138 212 0 186
+86 228 163 73 74 168 168 16 92 202 178 47 185 210 118 161 189 92 52
+245 239 86 57 9 253 64 85 201 185 96 90 233 22 8 153 163 31 199 91
+110 251 174 95 194 226 135 85 205 26 21 93 49 249 74 126 194 217 136
+37 65 25 222 161 22 22 62 159 14 44 191 164 23 170 212 140 251 214
+142 5 30 229 209 10 55 246 150 93 14 17 36 10 55 33 77 220 208 240
+168 219 59 38 208 203 217 64 157 163 202 143 101 13 165 52 48 225 54
+28 251 158 58 251 243 236 26 72 172 19 167 59 100 119 216 198 57 24
+132 148 105 10 29 3 140 245 113 32 209 138 94 164 57;
+#X obj 65 28 inlet;
+#X obj 113 26 outlet;
+#X connect 0 0 2 0;
+#X connect 1 0 0 0;
+#X restore 49 179 pd list-1024;
+#X obj 49 150 until;
+#X msg 49 125 1024;
+#X obj 49 100 until;
+#X msg 49 75 100;
+#X connect 0 0 6 0;
+#X connect 2 0 1 0;
+#X connect 3 0 2 0;
+#X connect 4 0 3 0;
+#X connect 5 0 4 0;
+#X connect 6 0 5 0;
+#X restore 275 209 pd data;
+#X obj 430 140 t b b;
+#X obj 430 162 del 500;
+#N canvas 5 49 450 300 \$0-test5 0;
+#X obj 86 168 \$1;
+#X obj 86 54 inlet;
+#X connect 1 0 0 0;
+#X restore 118 346 pd \$0-test5;
+#X obj 397 240 s pd-\$0-test5;
+#X connect 0 0 19 0;
+#X connect 1 0 19 0;
+#X connect 2 0 3 0;
+#X connect 3 0 5 0;
+#X connect 4 0 20 0;
+#X connect 5 0 8 0;
+#X connect 5 1 15 0;
+#X connect 7 0 6 0;
+#X connect 8 0 9 0;
+#X connect 8 1 7 0;
+#X connect 9 0 10 0;
+#X connect 9 1 0 0;
+#X connect 10 0 11 0;
+#X connect 11 0 12 0;
+#X connect 11 1 16 0;
+#X connect 12 0 17 0;
+#X connect 13 0 14 0;
+#X connect 13 1 4 0;
+#X connect 14 0 6 0;
+#X connect 15 0 0 0;
+#X connect 15 1 1 0;
+#X connect 15 2 4 0;
+#X connect 15 3 16 0;
+#X connect 16 0 19 0;
+#X connect 17 0 18 0;
+#X connect 18 0 13 0;
+#X restore 231 490 pd test5;
+#X connect 13 0 22 0;
+#X connect 14 0 22 0;
+#X connect 15 0 22 0;
+#X connect 16 0 22 0;
+#X connect 17 0 19 0;
+#X connect 18 0 19 0;
+#X connect 19 0 20 0;
+#X connect 22 0 21 0;
+#X connect 23 0 27 0;
+#X connect 24 0 27 0;
+#X connect 25 0 27 0;
+#X connect 27 0 26 0;
+#X connect 28 0 34 0;
+#X connect 29 0 34 0;
+#X connect 30 0 34 0;
+#X connect 31 0 34 0;
+#X connect 33 0 34 0;
+#X connect 34 0 32 0;
+#X connect 35 0 40 0;
+#X connect 36 0 40 0;
+#X connect 37 0 40 0;
+#X connect 39 0 40 0;
+#X connect 40 0 38 0;
diff --git a/tests/packetgenerator.pd b/tests/packetgenerator.pd
new file mode 100644
index 0000000..bd7a9df
--- /dev/null
+++ b/tests/packetgenerator.pd
@@ -0,0 +1,61 @@
+#N canvas 139 114 832 501 10;
+#X obj 94 27 inlet on/off;
+#X obj 94 119 metro 100;
+#X obj 94 336 outlet data;
+#X obj 252 29 inlet packetsize;
+#N canvas 9 49 701 343 makepacket 0;
+#X obj 120 19 inlet value;
+#X obj 328 22 inlet length;
+#X obj 328 44 i 10;
+#X obj 421 21 loadbang;
+#X obj 328 66 t f b;
+#X obj 328 88 until;
+#X msg 120 170 list;
+#X msg 328 110 adddollar 1;
+#X obj 70 290 outlet;
+#X floatatom 391 54 5 0 0 0 - - -;
+#X msg 419 112 set list;
+#X connect 0 0 6 0;
+#X connect 1 0 2 0;
+#X connect 2 0 4 0;
+#X connect 3 0 2 0;
+#X connect 4 0 5 0;
+#X connect 4 1 10 0;
+#X connect 5 0 7 0;
+#X connect 6 0 8 0;
+#X connect 7 0 6 0;
+#X connect 9 0 2 0;
+#X connect 10 0 6 0;
+#X restore 94 191 pd makepacket;
+#N canvas 6 49 450 300 count 0;
+#X obj 106 68 i;
+#X obj 106 110 + 1;
+#X obj 106 90 % 255;
+#X obj 106 132 t f f;
+#X obj 106 36 inlet;
+#X obj 106 154 outlet;
+#X obj 198 33 inlet value;
+#X connect 0 0 2 0;
+#X connect 1 0 3 0;
+#X connect 2 0 1 0;
+#X connect 3 0 5 0;
+#X connect 3 1 0 1;
+#X connect 4 0 0 0;
+#X connect 6 0 0 1;
+#X restore 94 168 pd count 1..255;
+#X obj 94 89 t f f;
+#X obj 94 213 t l l;
+#X obj 504 32 inlet rate;
+#X obj 95 49 route float bang;
+#X obj 177 124 t b;
+#X connect 0 0 9 0;
+#X connect 1 0 5 0;
+#X connect 3 0 4 1;
+#X connect 4 0 7 0;
+#X connect 5 0 4 0;
+#X connect 6 0 1 0;
+#X connect 7 0 2 0;
+#X connect 8 0 1 1;
+#X connect 9 0 6 0;
+#X connect 9 1 10 0;
+#X connect 10 0 5 0;
diff --git a/tests/reconnect/01_reconnect-crash.pd b/tests/reconnect/01_reconnect-crash.pd
new file mode 100644
index 0000000..b235768
--- /dev/null
+++ b/tests/reconnect/01_reconnect-crash.pd
@@ -0,0 +1,30 @@
+#N canvas 243 49 699 424 10;
+#X msg 22 255 disconnect;
+#X msg 112 177 connect localhost 44100;
+#X obj 21 344 tcpserver 44100;
+#X obj 22 322 tcpclient;
+#X obj 22 149 t b b b;
+#X obj 22 70 tgl 15 0 empty empty empty 17 7 0 10 -261234 -1 -1 1 1
+;
+#X msg 106 248 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
+22 23 24 25 26 27 28 29 30 255;
+#X obj 106 219 del 20;
+#X obj 22 231 del 40;
+#X obj 22 110 metro 60;
+#X text 78 68 This patch appears to crash Pd after a few cycles of
+disconnect|send|reconnect.;
+#X text 44 71 <-;
+#X floatatom 68 378 5 0 0 0 - - -;
+#X msg 217 349 64 64 64;
+#X connect 0 0 3 0;
+#X connect 1 0 3 0;
+#X connect 2 1 12 0;
+#X connect 4 0 8 0;
+#X connect 4 1 7 0;
+#X connect 4 2 1 0;
+#X connect 5 0 9 0;
+#X connect 6 0 3 0;
+#X connect 7 0 6 0;
+#X connect 8 0 0 0;
+#X connect 9 0 4 0;
+#X connect 13 0 2 0;
diff --git a/tests/reconnect/04_reconnect-dropped-byte-2-client.pd b/tests/reconnect/04_reconnect-dropped-byte-2-client.pd
new file mode 100644
index 0000000..6cfd0c2
--- /dev/null
+++ b/tests/reconnect/04_reconnect-dropped-byte-2-client.pd
@@ -0,0 +1,85 @@
+#N canvas 2026 49 530 584 10;
+#X msg 5 222 disconnect;
+#X msg 46 107 connect localhost 44100;
+#X obj 46 285 tcpclient;
+#X obj 148 391 list prepend;
+#X obj 46 322 sel 255;
+#X obj 85 429 list append;
+#X obj 165 469 list length;
+#X obj 85 468 t a a;
+#X obj 165 491 sel 30;
+#X obj 198 566 print ERROR;
+#X msg 198 545 byte count wrong: \$1 bytes;
+#X obj 46 81 metro 1000;
+#X obj 46 344 t b b b;
+#X obj 46 34 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
+;
+#X floatatom 135 47 5 0 0 0 - - -;
+#X obj 46 262 t a a;
+#X msg 399 44 bang;
+#X obj 399 64 print foo;
+#X obj 340 429 i;
+#X obj 340 449 + 1;
+#X obj 340 469 t f f;
+#X floatatom 340 489 5 0 0 0 - - -;
+#X obj 317 56 metro 1000;
+#X obj 317 76 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
+-1;
+#X obj 317 33 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X msg 137 25 10;
+#X floatatom 78 181 5 0 0 0 - - -;
+#X obj 78 220 payload;
+#X obj 198 519 t f b b;
+#X msg 256 516 0;
+#X obj 135 64 t f f;
+#X obj 176 80 print timmms;
+#X obj 46 305 t a a;
+#X obj 78 200 sel 1 0;
+#X obj 148 410 t a a;
+#X obj 86 262 sprint TCPCLIENT;
+#X obj 89 304 sprint CLIENTrec;
+#X obj 85 526 sprint packet 1;
+#X connect 0 0 15 0;
+#X connect 1 0 15 0;
+#X connect 2 0 32 0;
+#X connect 2 2 26 0;
+#X connect 3 0 34 0;
+#X connect 4 0 12 0;
+#X connect 4 1 3 0;
+#X connect 5 0 7 0;
+#X connect 6 0 8 0;
+#X connect 7 0 37 0;
+#X connect 7 1 6 0;
+#X connect 8 1 28 0;
+#X connect 10 0 9 0;
+#X connect 11 0 1 0;
+#X connect 12 0 0 0;
+#X connect 12 1 5 1;
+#X connect 12 1 3 1;
+#X connect 12 2 5 0;
+#X connect 13 0 11 0;
+#X connect 14 0 30 0;
+#X connect 15 0 2 0;
+#X connect 15 1 35 0;
+#X connect 16 0 17 0;
+#X connect 18 0 19 0;
+#X connect 19 0 20 0;
+#X connect 20 0 21 0;
+#X connect 20 1 18 1;
+#X connect 22 0 23 0;
+#X connect 24 0 22 0;
+#X connect 25 0 14 0;
+#X connect 26 0 33 0;
+#X connect 27 0 15 0;
+#X connect 28 0 10 0;
+#X connect 28 1 18 0;
+#X connect 28 2 29 0;
+#X connect 30 0 11 1;
+#X connect 30 1 31 0;
+#X connect 32 0 4 0;
+#X connect 32 1 36 0;
+#X connect 33 0 27 0;
+#X connect 33 1 34 0;
+#X connect 34 0 5 1;
+#X connect 34 1 3 1;
diff --git a/tests/reconnect/04_reconnect-dropped-byte-2-server.pd b/tests/reconnect/04_reconnect-dropped-byte-2-server.pd
new file mode 100644
index 0000000..2b4ab7e
--- /dev/null
+++ b/tests/reconnect/04_reconnect-dropped-byte-2-server.pd
@@ -0,0 +1,17 @@
+#N canvas 1298 426 599 289 10;
+#X obj 77 93 list prepend broadcast;
+#X obj 77 115 list trim;
+#X obj 77 36 tcpserver 44100;
+#X obj 19 53 t a a a;
+#X obj 77 56 t a a a;
+#X obj 212 169 select 255;
+#X obj 212 189 sprint =======================;
+#X obj 126 56 sprint TCPSERVER;
+#X connect 0 0 1 0;
+#X connect 1 0 3 0;
+#X connect 2 0 4 0;
+#X connect 3 1 2 0;
+#X connect 4 0 5 0;
+#X connect 4 1 0 0;
+#X connect 4 2 7 0;
+#X connect 5 0 6 0;
diff --git a/tests/reconnect/payload.pd b/tests/reconnect/payload.pd
new file mode 100644
index 0000000..4779114
--- /dev/null
+++ b/tests/reconnect/payload.pd
@@ -0,0 +1,7 @@
+#N canvas 4 49 450 300 10;
+#X obj 135 52 inlet bang;
+#X obj 142 256 outlet data;
+#X msg 86 140 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
+22 23 24 25 26 27 28 29 30 255;
+#X connect 0 0 2 0;
+#X connect 2 0 1 0;
diff --git a/tests/reconnect/reconnect-dropped-byte.pd b/tests/reconnect/reconnect-dropped-byte.pd
new file mode 100644
index 0000000..bb5587d
--- /dev/null
+++ b/tests/reconnect/reconnect-dropped-byte.pd
@@ -0,0 +1,56 @@
+#N canvas 242 49 530 584 10;
+#X msg 23 208 disconnect;
+#X msg 113 130 connect localhost 44100;
+#X obj 335 71 list prepend broadcast;
+#X obj 335 93 list trim;
+#X obj 298 62 t a;
+#X obj 335 44 tcpserver 44100;
+#X obj 46 285 tcpclient;
+#X obj 23 102 t b b b;
+#X obj 107 172 del 30;
+#X obj 23 184 del 60;
+#X obj 23 63 metro 100;
+#X obj 23 23 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
+;
+#X obj 136 374 list prepend;
+#X obj 231 374 t a;
+#X obj 46 322 sel 255;
+#X obj 73 399 list append;
+#X obj 46 344 t b b;
+#X obj 153 452 list length;
+#X obj 73 421 t a a;
+#X obj 153 474 sel 30;
+#X obj 186 519 print ERROR;
+#X msg 107 201 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
+22 23 24 25 26 27 28 29 30 255;
+#X obj 73 509 print packet;
+#X msg 186 498 byte count wrong: \$1 bytes;
+#X connect 0 0 6 0;
+#X connect 1 0 6 0;
+#X connect 2 0 3 0;
+#X connect 3 0 4 0;
+#X connect 4 0 5 0;
+#X connect 5 0 2 0;
+#X connect 6 0 14 0;
+#X connect 7 0 9 0;
+#X connect 7 1 8 0;
+#X connect 7 2 1 0;
+#X connect 8 0 21 0;
+#X connect 9 0 0 0;
+#X connect 10 0 7 0;
+#X connect 11 0 10 0;
+#X connect 12 0 13 0;
+#X connect 12 0 15 1;
+#X connect 13 0 12 1;
+#X connect 14 0 16 0;
+#X connect 14 1 12 0;
+#X connect 15 0 18 0;
+#X connect 16 0 15 1;
+#X connect 16 0 12 1;
+#X connect 16 1 15 0;
+#X connect 17 0 19 0;
+#X connect 18 0 22 0;
+#X connect 18 1 17 0;
+#X connect 19 1 23 0;
+#X connect 21 0 6 0;
+#X connect 23 0 20 0;
diff --git a/tests/reconnect/serialize.pd b/tests/reconnect/serialize.pd
new file mode 100644
index 0000000..f296d5f
--- /dev/null
+++ b/tests/reconnect/serialize.pd
@@ -0,0 +1,17 @@
+#N canvas 4 49 450 300 10;
+#X obj 63 190 list split 1;
+#X obj 63 107 until;
+#X obj 63 145 list append;
+#X obj 89 74 t b l;
+#X obj 193 190 bang;
+#X obj 63 210 outlet;
+#X obj 99 45 inlet;
+#X connect 0 0 5 0;
+#X connect 0 1 2 1;
+#X connect 0 2 4 0;
+#X connect 1 0 2 0;
+#X connect 2 0 0 0;
+#X connect 3 0 1 0;
+#X connect 3 1 2 1;
+#X connect 4 0 1 1;
+#X connect 6 0 3 0;
diff --git a/tests/reconnect/sprint.pd b/tests/reconnect/sprint.pd
new file mode 100644
index 0000000..d78e2c7
--- /dev/null
+++ b/tests/reconnect/sprint.pd
@@ -0,0 +1,20 @@
+#N canvas 4 49 450 300 10;
+#X obj 74 144 spigot;
+#X obj 100 100 tgl 15 0 \$0-spigot \$0-spigot empty 17 7 0 10 -262144
+-1 -1 0 1;
+#X obj 141 134 r \$0-spigot;
+#X obj 74 53 inlet;
+#X obj 74 164 print \$1;
+#X obj 227 37 loadbang;
+#X obj 227 57 list prepend \$2;
+#X obj 227 77 route float;
+#X obj 227 97 s \$0-spigot;
+#X obj 354 31 inlet;
+#X connect 0 0 4 0;
+#X connect 2 0 0 1;
+#X connect 3 0 0 0;
+#X connect 5 0 6 0;
+#X connect 6 0 7 0;
+#X connect 7 0 8 0;
+#X connect 9 0 7 0;
+#X coords 0 -1 1 1 15 15 1 100 100;
diff --git a/tests/reflect/01_tcp.pd b/tests/reflect/01_tcp.pd
new file mode 100644
index 0000000..1a727f8
--- /dev/null
+++ b/tests/reflect/01_tcp.pd
@@ -0,0 +1,20 @@
+#N canvas 1583 339 487 300 10;
+#X obj 54 183 spigot;
+#X obj 54 227 t f f;
+#X obj 54 249 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
+1;
+#X msg 120 184 disconnect \, connect localhost 9998;
+#X text 44 26 this sends all data received on TCP:9999 back on TCP:9998
+;
+#X obj 120 158 loadbang;
+#X obj 54 112 tcpreceive 9999;
+#X obj 54 205 tcpsend;
+#X obj 54 134 t a a;
+#X connect 0 0 7 0;
+#X connect 1 0 2 0;
+#X connect 1 1 0 1;
+#X connect 3 0 7 0;
+#X connect 5 0 3 0;
+#X connect 6 0 8 0;
+#X connect 7 0 1 0;
+#X connect 8 0 0 0;
diff --git a/tests/reflect/02_udp.pd b/tests/reflect/02_udp.pd
new file mode 100644
index 0000000..939f96a
--- /dev/null
+++ b/tests/reflect/02_udp.pd
@@ -0,0 +1,18 @@
+#N canvas 341 348 487 300 10;
+#X obj 54 112 udpreceive 9999;
+#X obj 54 205 udpsend;
+#X obj 54 183 spigot;
+#X obj 54 227 t f f;
+#X obj 54 249 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X msg 120 184 disconnect \, connect localhost 9998;
+#X text 44 26 this sends all data received on UDP:9999 back on UDP:9998
+;
+#X obj 120 158 loadbang;
+#X connect 0 0 2 0;
+#X connect 1 0 3 0;
+#X connect 2 0 1 0;
+#X connect 3 0 4 0;
+#X connect 3 1 2 1;
+#X connect 5 0 1 0;
+#X connect 7 0 5 0;
diff --git a/tests/reflect/03_tcpserver.pd b/tests/reflect/03_tcpserver.pd
new file mode 100644
index 0000000..7748070
--- /dev/null
+++ b/tests/reflect/03_tcpserver.pd
@@ -0,0 +1,59 @@
+#N canvas 148 388 826 376 10;
+#X obj 116 59 tcpserver 9999;
+#X obj 28 66 t a a;
+#X msg 144 26 serialize 0;
+#X text 376 126 OLD=0.077s (+dropout);
+#X text 45 199 zmoelnig/rtsp.log (37M);
+#X text 43 173 YoYoTheMovie_comp.mov;
+#X text 375 158 OLD=0.735 (+dropouts);
+#X text 35 225 zmoelnig/Hydro...wav (223M);
+#X text 379 140 NEW=0.104s (+dropout);
+#X text 374 169 NEW=0.812 (+dropouts);
+#X text 382 206 NEW=9.880 (+dropouts \, NOfreeze);
+#X text 377 188 OLD=9.341 (+dropouts \, NOfreeze);
+#X text 443 98 reflect;
+#X text 637 95 receive-only;
+#X text 641 165 0.67 (+dropouts);
+#X text 641 136 0.064 (+dropouts);
+#X text 632 198 3.672(+dropouts);
+#X text 632 185 3.672(+fewdropouts);
+#X text 634 213 MRPEACH:4.8(NOdrops);
+#X obj 31 125 list prepend broadcast;
+#X obj 31 147 list trim;
+#X obj 245 64 list length;
+#X obj 245 86 +;
+#X obj 245 108 t f f;
+#X obj 229 128 f;
+#X obj 258 33 t b b;
+#X msg 277 88 0;
+#X floatatom 229 150 0 0 0 0 - - -;
+#X msg 254 8 bang;
+#X floatatom 229 223 0 0 0 0 - - -;
+#X msg 259 130 bang;
+#X obj 229 172 / 1000;
+#X obj 229 194 int;
+#X obj 286 174 % 1000;
+#X floatatom 286 196 5 0 0 0 - - -, f 5;
+#X msg 205 106 bang;
+#X connect 0 0 1 0;
+#X connect 1 0 19 0;
+#X connect 1 1 21 0;
+#X connect 2 0 0 0;
+#X connect 19 0 20 0;
+#X connect 20 0 0 0;
+#X connect 21 0 22 0;
+#X connect 22 0 23 0;
+#X connect 23 0 24 1;
+#X connect 23 1 22 1;
+#X connect 24 0 27 0;
+#X connect 25 0 26 0;
+#X connect 25 1 24 0;
+#X connect 26 0 23 0;
+#X connect 27 0 31 0;
+#X connect 27 0 33 0;
+#X connect 28 0 25 0;
+#X connect 30 0 27 0;
+#X connect 31 0 32 0;
+#X connect 32 0 29 0;
+#X connect 33 0 34 0;
+#X connect 35 0 24 0;
diff --git a/tests/sequence/01_tcpclient.pd b/tests/sequence/01_tcpclient.pd
new file mode 100644
index 0000000..c9ffd18
--- /dev/null
+++ b/tests/sequence/01_tcpclient.pd
@@ -0,0 +1,119 @@
+#N canvas 501 150 636 624 10;
+#X obj 139 179 tcpclient;
+#X msg 308 152 connect \$1 9999;
+#X msg 308 108 bang;
+#X obj 308 130 symbol localhost;
+#X symbolatom 351 112 10 0 0 0 - - -;
+#X obj 159 201 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 127
+127;
+#X obj 139 284 list split 1;
+#X obj 139 242 until;
+#X obj 139 263 list append;
+#X obj 139 219 t b l;
+#X obj 183 243 bang;
+#X obj 139 306 select 255;
+#X obj 139 328 i;
+#X obj 139 350 + 1;
+#X obj 139 372 t f f;
+#X obj 121 398 f;
+#X obj 114 108 metro 100;
+#X obj 114 85 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X msg 114 130 1;
+#X obj 79 323 t b b;
+#X msg 108 345 0;
+#X floatatom 121 555 5 0 0 3 dummyload - -;
+#X obj 253 378 -;
+#X obj 252 354 t f f;
+#X obj 253 400 select 1;
+#X obj 306 489 print error;
+#X obj 306 443 pack 0 0 0;
+#X obj 185 426 t f f;
+#X obj 373 416 + 1;
+#X obj 185 448 select 254;
+#X msg 185 470 -1;
+#X obj 206 328 t b f f f;
+#X msg 306 465 \$2 should be \$3;
+#X obj 306 421 t b b;
+#X obj 459 485 i;
+#X obj 459 507 + 1;
+#X obj 459 529 t f f;
+#X floatatom 459 551 5 0 0 3 errors - -;
+#X text 49 27 testing the server;
+#X floatatom 188 78 5 0 0 0 - - -;
+#X obj 55 394 i;
+#X obj 55 416 + 1;
+#X obj 55 438 t f f;
+#X floatatom 22 481 5 0 0 3 iterations - -;
+#X msg 56 372 0;
+#X obj 52 125 t b b;
+#X obj 52 147 timer;
+#X floatatom 52 169 5 0 0 0 - - -;
+#X obj 22 458 i;
+#X obj 14 344 metro 100;
+#X msg 14 366 bang;
+#X obj 16 325 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X connect 0 0 9 0;
+#X connect 0 1 5 0;
+#X connect 1 0 0 0;
+#X connect 2 0 3 0;
+#X connect 3 0 1 0;
+#X connect 4 0 3 0;
+#X connect 6 0 11 0;
+#X connect 6 1 8 1;
+#X connect 6 2 10 0;
+#X connect 7 0 8 0;
+#X connect 8 0 6 0;
+#X connect 9 0 7 0;
+#X connect 9 1 8 1;
+#X connect 10 0 7 1;
+#X connect 11 0 12 0;
+#X connect 11 1 31 0;
+#X connect 12 0 13 0;
+#X connect 13 0 14 0;
+#X connect 14 0 15 1;
+#X connect 14 1 12 1;
+#X connect 15 0 21 0;
+#X connect 16 0 18 0;
+#X connect 16 0 45 0;
+#X connect 17 0 16 0;
+#X connect 18 0 0 0;
+#X connect 19 0 15 0;
+#X connect 19 1 20 0;
+#X connect 19 1 40 0;
+#X connect 20 0 12 1;
+#X connect 22 0 24 0;
+#X connect 23 0 22 1;
+#X connect 23 1 22 0;
+#X connect 24 1 33 0;
+#X connect 26 0 32 0;
+#X connect 27 0 29 0;
+#X connect 27 1 28 0;
+#X connect 28 0 26 2;
+#X connect 29 0 30 0;
+#X connect 30 0 22 1;
+#X connect 31 0 19 0;
+#X connect 31 1 27 0;
+#X connect 31 2 23 0;
+#X connect 31 3 26 1;
+#X connect 32 0 25 0;
+#X connect 33 0 26 0;
+#X connect 33 1 34 0;
+#X connect 34 0 35 0;
+#X connect 35 0 36 0;
+#X connect 36 0 37 0;
+#X connect 36 1 34 1;
+#X connect 39 0 16 1;
+#X connect 40 0 41 0;
+#X connect 41 0 42 0;
+#X connect 42 0 48 1;
+#X connect 42 1 40 1;
+#X connect 44 0 40 0;
+#X connect 45 0 46 0;
+#X connect 45 1 46 1;
+#X connect 46 0 47 0;
+#X connect 48 0 43 0;
+#X connect 49 0 50 0;
+#X connect 50 0 48 0;
+#X connect 51 0 49 0;
diff --git a/tests/sequence/01_tcpserver.pd b/tests/sequence/01_tcpserver.pd
new file mode 100644
index 0000000..200e97b
--- /dev/null
+++ b/tests/sequence/01_tcpserver.pd
@@ -0,0 +1,59 @@
+#N canvas 219 165 438 532 10;
+#X obj 71 256 tcpserver 9999;
+#X obj 71 278 t b;
+#X obj 71 300 i;
+#X obj 115 326 + 1;
+#X obj 115 348 % 255;
+#X obj 250 252 loadbang;
+#X msg 71 388 broadcast \$1;
+#X obj 71 429 list append;
+#X obj 250 274 f 1024;
+#X obj 250 296 t b f b;
+#X obj 250 438 list prepend;
+#X obj 273 319 until;
+#X obj 273 341 f 255;
+#X obj 273 363 list prepend;
+#X obj 273 385 t l l;
+#X msg 106 276 bang;
+#X msg 321 250 bang;
+#X obj 71 451 list trim;
+#X obj 23 229 t a;
+#X text 27 43 responds to any data from the client by sending pack
+a stream consisting of a header and a dummy payload.;
+#X text 31 84 the dummy payload is a number of 0xFF bytes;
+#X obj 71 322 t f f;
+#X text 32 99 the header is a single byte counting up from 0..254 (and
+wrapping around);
+#X floatatom 166 305 5 0 0 0 - - -;
+#X obj 152 169 route sent;
+#X obj 152 191 unpack 0 0 0;
+#X floatatom 186 225 0 0 0 0 - - -;
+#X floatatom 221 211 5 0 0 0 - - -;
+#X connect 0 0 1 0;
+#X connect 0 4 24 0;
+#X connect 1 0 2 0;
+#X connect 2 0 21 0;
+#X connect 3 0 4 0;
+#X connect 4 0 2 1;
+#X connect 5 0 8 0;
+#X connect 6 0 7 0;
+#X connect 7 0 17 0;
+#X connect 8 0 9 0;
+#X connect 9 0 10 0;
+#X connect 9 1 11 0;
+#X connect 10 0 7 1;
+#X connect 11 0 12 0;
+#X connect 12 0 13 0;
+#X connect 13 0 14 0;
+#X connect 14 0 10 1;
+#X connect 14 1 13 1;
+#X connect 15 0 1 0;
+#X connect 16 0 8 0;
+#X connect 17 0 18 0;
+#X connect 18 0 0 0;
+#X connect 21 0 6 0;
+#X connect 21 1 3 0;
+#X connect 23 0 3 1;
+#X connect 24 0 25 0;
+#X connect 25 1 26 0;
+#X connect 25 2 27 0;
diff --git a/tests/sequence/02_udpsendreceive.pd b/tests/sequence/02_udpsendreceive.pd
new file mode 100644
index 0000000..97cea8e
--- /dev/null
+++ b/tests/sequence/02_udpsendreceive.pd
@@ -0,0 +1,88 @@
+#N canvas 435 282 841 595 10;
+#X obj 106 234 udpsend;
+#X obj 106 24 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X obj 106 46 metro 100;
+#X floatatom 180 48 5 0 0 0 - - -;
+#X floatatom 206 151 5 1 65535 0 - - -;
+#X obj 151 336 t l l;
+#X obj 183 356 list length;
+#X obj 206 170 t f f;
+#X obj 151 400 t f f;
+#X obj 151 422 -;
+#X obj 151 514 +;
+#X obj 112 536 spigot;
+#X obj 112 558 print oops;
+#X obj 183 378 != 10;
+#X msg 151 493 1;
+#X msg 182 494 0;
+#X obj 151 447 select 1 -254;
+#X msg 394 144 2 \$1;
+#X obj 394 166 pow;
+#X floatatom 394 188 0 0 0 0 - - -;
+#X floatatom 386 55 5 0 0 0 - - -;
+#X obj 112 294 udpreceive 9999;
+#X msg 171 233 disconnect \, connect localhost 9999;
+#X obj 106 79 i 1;
+#X obj 106 101 until;
+#X floatatom 147 76 5 0 0 0 - - -;
+#X obj 316 336 t b b;
+#X obj 316 358 del 100;
+#X msg 316 380 0;
+#X obj 316 402 t f;
+#X msg 347 382 1;
+#X obj 316 424 change;
+#X floatatom 316 446 5 0 0 0 - - -;
+#X obj 106 127 ../packetgenerator;
+#X floatatom 275 301 5 0 0 0 - - -;
+#X obj 106 147 t l l;
+#X obj 133 184 ../bandwidth;
+#X symbolatom 133 206 10 0 0 0 - - -;
+#X obj 112 317 t l l b l;
+#X obj 391 319 ../bandwidth;
+#X symbolatom 391 341 10 0 0 0 - - -;
+#X connect 1 0 2 0;
+#X connect 2 0 23 0;
+#X connect 3 0 2 1;
+#X connect 4 0 7 0;
+#X connect 5 0 8 0;
+#X connect 5 1 6 0;
+#X connect 6 0 13 0;
+#X connect 7 0 33 1;
+#X connect 7 1 13 1;
+#X connect 8 0 9 1;
+#X connect 8 1 9 0;
+#X connect 9 0 16 0;
+#X connect 10 0 11 1;
+#X connect 11 0 12 0;
+#X connect 13 0 10 1;
+#X connect 14 0 10 0;
+#X connect 15 0 10 0;
+#X connect 16 0 15 0;
+#X connect 16 1 15 0;
+#X connect 16 2 14 0;
+#X connect 17 0 18 0;
+#X connect 18 0 19 0;
+#X connect 20 0 17 0;
+#X connect 21 0 34 0;
+#X connect 21 0 38 0;
+#X connect 22 0 0 0;
+#X connect 23 0 24 0;
+#X connect 24 0 33 0;
+#X connect 25 0 23 1;
+#X connect 26 0 27 0;
+#X connect 26 1 30 0;
+#X connect 27 0 28 0;
+#X connect 28 0 29 0;
+#X connect 29 0 31 0;
+#X connect 30 0 29 0;
+#X connect 31 0 32 0;
+#X connect 33 0 35 0;
+#X connect 35 0 0 0;
+#X connect 35 1 36 0;
+#X connect 36 0 37 0;
+#X connect 38 0 11 0;
+#X connect 38 1 5 0;
+#X connect 38 2 26 0;
+#X connect 38 3 39 0;
+#X connect 39 0 40 0;
diff --git a/tests/tcpclient_reflect.sh b/tests/tcpclient_reflect.sh
new file mode 100755
index 0000000..88ada91
--- /dev/null
+++ b/tests/tcpclient_reflect.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+
+PIPEFILE="pipe.$$"
+
+control_c()
+# run if user hits control-c
+{
+ echo -en "\n*** Ouch! Exiting ***\n"
+ rm -f ${PIPEFILE}
+ exit $?
+}
+
+P=$1
+PORT=$((P))
+if [ ${PORT} -lt 1 ]; then
+ echo "usage: $0 <port>" 1>&2
+ exit 1
+fi
+
+echo "register Ctrl-C"
+trap control_c SIGINT
+
+echo "make pipe"
+mknod ${PIPEFILE} p
+echo "start client"
+cat ${PIPEFILE} | nc -w 10 localhost ${PORT} > ${PIPEFILE}
+echo "client quit"
+rm ${PIPEFILE}
diff --git a/tests/tcpclient_stress/01_crashertest.pd b/tests/tcpclient_stress/01_crashertest.pd
new file mode 100644
index 0000000..c475938
--- /dev/null
+++ b/tests/tcpclient_stress/01_crashertest.pd
@@ -0,0 +1,61 @@
+#N canvas 242 49 538 461 10;
+#X msg 433 315 disconnect;
+#X msg 204 173 connect localhost 44100;
+#X obj 335 71 list prepend broadcast;
+#X obj 335 93 list trim;
+#X obj 298 62 t a;
+#X obj 57 159 osc/packOSC;
+#X obj 57 299 osc/unpackOSC;
+#X obj 57 321 osc/routeOSC /metro;
+#X obj 57 345 osc/routeOSC /interval;
+#X obj 57 88 metro 10;
+#X obj 57 14 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
+-1;
+#X text 78 13 <- make pd crash;
+#X obj 204 146 loadbang;
+#X obj 57 397 b;
+#X obj 57 277 mrpeach/slipdec;
+#X obj 57 181 mrpeach/slipenc;
+#X obj 57 235 tcpclient;
+#X obj 335 44 tcpserver 44100;
+#X obj 57 111 random 100;
+#X msg 57 135 /metro/interval \$1;
+#X floatatom 57 370 5 0 0 0 - - -;
+#X obj 433 356 print -n;
+#X obj 57 418 del 1000;
+#X text 97 368 <- do we still receive something?;
+#X text 123 414 <- disconnect if not;
+#X obj 99 63 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
+;
+#X msg 307 232 info;
+#X obj 433 278 spigot;
+#X obj 465 256 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X floatatom 134 68 5 0 0 0 - - -;
+#X connect 0 0 16 0;
+#X connect 0 0 21 0;
+#X connect 1 0 16 0;
+#X connect 2 0 3 0;
+#X connect 3 0 4 0;
+#X connect 4 0 17 0;
+#X connect 5 0 15 0;
+#X connect 6 0 7 0;
+#X connect 7 0 8 0;
+#X connect 8 0 20 0;
+#X connect 9 0 18 0;
+#X connect 10 0 9 0;
+#X connect 12 0 1 0;
+#X connect 13 0 22 0;
+#X connect 14 0 6 0;
+#X connect 15 0 16 0;
+#X connect 16 0 14 0;
+#X connect 17 0 2 0;
+#X connect 18 0 19 0;
+#X connect 19 0 5 0;
+#X connect 20 0 13 0;
+#X connect 22 0 27 0;
+#X connect 25 0 9 0;
+#X connect 26 0 16 0;
+#X connect 27 0 0 0;
+#X connect 28 0 27 1;
+#X connect 29 0 9 1;
diff --git a/tests/tcpclient_stress/02_crasherclient.pd b/tests/tcpclient_stress/02_crasherclient.pd
new file mode 100644
index 0000000..6a88b18
--- /dev/null
+++ b/tests/tcpclient_stress/02_crasherclient.pd
@@ -0,0 +1,147 @@
+#N canvas 287 122 538 703 10;
+#X msg 433 315 disconnect;
+#X obj 57 179 osc/packOSC;
+#X obj 57 299 osc/unpackOSC;
+#X obj 57 321 osc/routeOSC /metro;
+#X obj 57 345 osc/routeOSC /interval;
+#X obj 57 88 metro 10;
+#X obj 57 14 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
+-1;
+#X text 78 13 <- make pd crash;
+#X obj 204 146 loadbang;
+#X obj 57 417 b;
+#X obj 57 277 mrpeach/slipdec;
+#X obj 57 201 mrpeach/slipenc;
+#X obj 57 235 tcpclient;
+#X obj 57 111 random 100;
+#X msg 57 155 /metro/interval \$1;
+#X floatatom 31 485 5 0 0 0 - - -;
+#X obj 433 356 print -n;
+#X obj 57 438 del 1000;
+#X text 101 401 <- do we still receive something?;
+#X text 123 434 <- disconnect if not;
+#X obj 99 63 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
+;
+#X msg 307 232 info;
+#X obj 433 278 spigot;
+#X obj 465 256 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X msg 291 260 debug \$1;
+#X floatatom 363 230 5 0 0 0 - - -;
+#X msg 360 202 6;
+#X msg 136 89 bang;
+#X msg 408 205 2;
+#X msg 404 125 15;
+#X msg 419 173 31;
+#X obj 433 337 t a a;
+#X msg 18 203 bang;
+#X msg 468 220 14;
+#X msg 376 247 0;
+#X obj -17 276 loadbang;
+#X msg -17 343 set -1;
+#X obj -17 301 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
+1;
+#X msg 204 173 connect localhost 44101;
+#X obj -17 321 metro 1000;
+#X obj 62 258 t a a;
+#X obj 317 427 spigot;
+#X obj 317 449 print data;
+#X obj 373 428 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X obj 278 17 tgl 100 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
+1;
+#X obj 278 122 select 1 0;
+#X floatatom 141 59 5 0 0 0 - - -;
+#X obj 280 552 i;
+#X obj 280 574 + 1;
+#X obj 280 596 t f f;
+#X obj 70 369 t a b;
+#X obj 200 552 i;
+#X obj 200 574 + 1;
+#X obj 200 596 t f f;
+#X msg 371 581 0;
+#X floatatom 200 649 5 0 0 0 - - -;
+#X obj 218 617 r gui;
+#X obj 200 632 spigot 1;
+#X floatatom 280 649 5 0 0 0 - - -;
+#X obj 298 617 r gui;
+#X obj 280 632 spigot 1;
+#X obj 31 395 t f b;
+#X obj 49 453 r gui;
+#X obj 31 468 spigot 1;
+#X obj 81 591 s gui;
+#X obj 81 571 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
+1;
+#X floatatom 166 130 5 0 0 0 - - -;
+#X obj 184 98 r gui;
+#X obj 166 113 spigot 1;
+#X obj 57 132 t a b f;
+#X connect 0 0 31 0;
+#X connect 1 0 11 0;
+#X connect 2 0 3 0;
+#X connect 3 0 4 0;
+#X connect 4 0 50 0;
+#X connect 5 0 13 0;
+#X connect 6 0 5 0;
+#X connect 9 0 17 0;
+#X connect 10 0 2 0;
+#X connect 11 0 12 0;
+#X connect 12 0 40 0;
+#X connect 13 0 69 0;
+#X connect 14 0 1 0;
+#X connect 17 0 22 0;
+#X connect 20 0 5 0;
+#X connect 21 0 12 0;
+#X connect 22 0 0 0;
+#X connect 23 0 22 1;
+#X connect 24 0 12 0;
+#X connect 25 0 24 0;
+#X connect 26 0 25 0;
+#X connect 27 0 13 0;
+#X connect 28 0 25 0;
+#X connect 29 0 25 0;
+#X connect 30 0 25 0;
+#X connect 31 0 12 0;
+#X connect 31 1 16 0;
+#X connect 32 0 12 0;
+#X connect 33 0 25 0;
+#X connect 34 0 25 0;
+#X connect 35 0 37 0;
+#X connect 36 0 15 0;
+#X connect 37 0 39 0;
+#X connect 38 0 12 0;
+#X connect 39 0 36 0;
+#X connect 40 0 10 0;
+#X connect 40 1 41 0;
+#X connect 41 0 42 0;
+#X connect 43 0 41 1;
+#X connect 44 0 45 0;
+#X connect 45 0 38 0;
+#X connect 45 1 0 0;
+#X connect 46 0 5 1;
+#X connect 47 0 48 0;
+#X connect 48 0 49 0;
+#X connect 49 0 60 0;
+#X connect 49 1 47 1;
+#X connect 50 0 61 0;
+#X connect 50 1 51 0;
+#X connect 51 0 52 0;
+#X connect 52 0 53 0;
+#X connect 53 0 57 0;
+#X connect 53 1 51 1;
+#X connect 54 0 53 0;
+#X connect 54 0 49 0;
+#X connect 56 0 57 1;
+#X connect 57 0 55 0;
+#X connect 59 0 60 1;
+#X connect 60 0 58 0;
+#X connect 61 0 63 0;
+#X connect 61 1 9 0;
+#X connect 62 0 63 1;
+#X connect 63 0 15 0;
+#X connect 65 0 64 0;
+#X connect 67 0 68 1;
+#X connect 68 0 66 0;
+#X connect 69 0 14 0;
+#X connect 69 1 47 0;
+#X connect 69 2 68 0;
diff --git a/tests/tcpclient_stress/02_crasherserver.pd b/tests/tcpclient_stress/02_crasherserver.pd
new file mode 100644
index 0000000..831707b
--- /dev/null
+++ b/tests/tcpclient_stress/02_crasherserver.pd
@@ -0,0 +1,20 @@
+#N canvas 642 62 538 461 10;
+#X obj 335 71 list prepend broadcast;
+#X obj 335 93 list trim;
+#X obj 335 44 tcpserver 44101;
+#X msg 175 45 debug \$1;
+#X floatatom 164 20 5 0 0 0 - - -;
+#X obj 286 91 t a a;
+#X obj 320 248 print aaa;
+#X obj 321 226 spigot;
+#X obj 377 227 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X connect 0 0 1 0;
+#X connect 1 0 5 0;
+#X connect 2 0 0 0;
+#X connect 3 0 2 0;
+#X connect 4 0 3 0;
+#X connect 5 0 2 0;
+#X connect 5 1 7 0;
+#X connect 7 0 6 0;
+#X connect 8 0 7 1;
diff --git a/tests/tcpserver.py b/tests/tcpserver.py
new file mode 100755
index 0000000..621bf8b
--- /dev/null
+++ b/tests/tcpserver.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+import SocketServer
+
+class MyTCPHandler(SocketServer.BaseRequestHandler):
+ """
+ The RequestHandler class for our server.
+
+ It is instantiated once per connection to the server, and must
+ override the handle() method to implement communication to the
+ client.
+ """
+
+ def handle(self):
+ # self.request is the TCP socket connected to the client
+ self.data = self.request.recv(1024).strip()
+ print "{} wrote:".format(self.client_address[0])
+ print self.data
+ # just send back the same data, but upper-cased
+ self.request.sendall(self.data.upper())
+
+if __name__ == "__main__":
+ import sys
+ HOST, PORT = "localhost", 9999
+ if len(sys.argv)>1:
+ PORT=int(sys.argv[1])
+ print("binding to %s:%s" % (HOST, PORT))
+
+ # Create the server, binding to localhost on port 9999
+ server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler)
+
+ # Activate the server; this will keep running until you
+ # interrupt the program with Ctrl-C
+ server.serve_forever()
diff --git a/tests/tcpserver_reflect.sh b/tests/tcpserver_reflect.sh
new file mode 100755
index 0000000..d64beaf
--- /dev/null
+++ b/tests/tcpserver_reflect.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+
+PIPEFILE="pipe.$$"
+
+control_c()
+# run if user hits control-c
+{
+ echo -en "\n*** Ouch! Exiting ***\n"
+ rm -f ${PIPEFILE}
+ exit $?
+}
+
+P=$1
+PORT=$((P))
+if [ ${PORT} -lt 1 ]; then
+ echo "usage: $0 <port>" 1>&2
+ exit 1
+fi
+
+echo "register Ctrl-C"
+trap control_c SIGINT
+
+echo "make pipe"
+mknod ${PIPEFILE} p
+echo "start server"
+cat ${PIPEFILE} | nc -l -p ${PORT} > ${PIPEFILE}
+echo "server quit"
+rm ${PIPEFILE}
diff --git a/tests/tcpsink.sh b/tests/tcpsink.sh
new file mode 100755
index 0000000..6716bed
--- /dev/null
+++ b/tests/tcpsink.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+P=$1
+PORT=$((P))
+if [ ${PORT} -lt 1 ]; then
+ echo "usage: $0 <port>" 1>&2
+ exit 1
+fi
+
+nc -l -p ${PORT} > /dev/null
diff --git a/tests/tcpsource.sh b/tests/tcpsource.sh
new file mode 100755
index 0000000..f3527a6
--- /dev/null
+++ b/tests/tcpsource.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+P=$1
+PORT=$((P))
+if [ ${PORT} -lt 1 ]; then
+ echo "usage: $0 <port>" 1>&2
+ exit 1
+fi
+
+yes abcdefghijklmnopqrstuvwxyz | nc localhost ${PORT} > /dev/null
diff --git a/tests/udpclient_reflect.sh b/tests/udpclient_reflect.sh
new file mode 100755
index 0000000..34f0717
--- /dev/null
+++ b/tests/udpclient_reflect.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+
+PIPEFILE="pipe.$$"
+
+control_c()
+# run if user hits control-c
+{
+ echo -en "\n*** Ouch! Exiting ***\n"
+ rm -f ${PIPEFILE}
+ exit $?
+}
+
+P=$1
+PORT=$((P))
+if [ ${PORT} -lt 1 ]; then
+ echo "usage: $0 <port>" 1>&2
+ exit 1
+fi
+
+echo "register Ctrl-C"
+trap control_c SIGINT
+
+echo "make pipe"
+mknod ${PIPEFILE} p
+echo "UDP" > ${PIPEFILE} &
+echo "start client"
+cat ${PIPEFILE} | nc -w 10 -u localhost ${PORT} > ${PIPEFILE}
+echo "client quit"
+rm ${PIPEFILE}
diff --git a/tests/udpserver_reflect.sh b/tests/udpserver_reflect.sh
new file mode 100755
index 0000000..718049f
--- /dev/null
+++ b/tests/udpserver_reflect.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+
+PIPEFILE="pipe.$$"
+
+control_c()
+# run if user hits control-c
+{
+ echo -en "\n*** Ouch! Exiting ***\n"
+ rm -f ${PIPEFILE}
+ exit $?
+}
+
+P=$1
+PORT=$((P))
+if [ ${PORT} -lt 1 ]; then
+ echo "usage: $0 <port>" 1>&2
+ exit 1
+fi
+
+echo "register Ctrl-C"
+trap control_c SIGINT
+
+echo "make pipe"
+mknod ${PIPEFILE} p
+echo "start server"
+cat ${PIPEFILE} | nc -w 10 -u -l -p ${PORT} > ${PIPEFILE}
+echo "server quit"
+rm ${PIPEFILE}
diff --git a/tests/udpsink.sh b/tests/udpsink.sh
new file mode 100755
index 0000000..0966b85
--- /dev/null
+++ b/tests/udpsink.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+P=$1
+PORT=$((P))
+if [ ${PORT} -lt 1 ]; then
+ echo "usage: $0 <port>" 1>&2
+ exit 1
+fi
+
+nc -u -l -p ${PORT} > /dev/null
diff --git a/tests/udpsource.sh b/tests/udpsource.sh
new file mode 100755
index 0000000..f48cd55
--- /dev/null
+++ b/tests/udpsource.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+P=$1
+PORT=$((P))
+if [ ${PORT} -lt 1 ]; then
+ echo "usage: $0 <port>" 1>&2
+ exit 1
+fi
+
+yes abcdefghijklmnopqrstuvwxyz | nc -u localhost ${PORT} > /dev/null