aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--iemnet.c9
-rw-r--r--iemnet.h14
-rw-r--r--tcpclient.c2
-rw-r--r--tcpreceive.c4
-rw-r--r--tcpserver.c2
5 files changed, 27 insertions, 4 deletions
diff --git a/iemnet.c b/iemnet.c
index 16025cf..aadc90e 100644
--- a/iemnet.c
+++ b/iemnet.c
@@ -29,6 +29,15 @@ void iemnet__addrout(t_outlet*status_outlet, t_outlet*address_outlet,
}
+void iemnet__streamout(t_outlet*outlet, int argc, t_atom*argv) {
+ if(NULL==outlet)return;
+ while(argc-->0) {
+ outlet_list(outlet, gensym("list"), 1, argv);
+ argv++;
+ }
+
+}
+
#ifdef _MSC_VER
void tcpclient_setup(void);
diff --git a/iemnet.h b/iemnet.h
index 3cc21f5..e26fe46 100644
--- a/iemnet.h
+++ b/iemnet.h
@@ -223,6 +223,20 @@ int iemnet__receiver_getsize(t_iemnet_receiver*);
*/
void iemnet__addrout(t_outlet*status_outlet, t_outlet*address_outlet, long address, unsigned short port);
+/**
+ * output a list as a stream (serialize)
+ *
+ * the given list of atoms will be sent to the output one-by-one
+ *
+ * \param outlet outlet to sent the data to
+ * \param argc size of the list
+ * \param argv data
+ *
+ * \note with stream based protocols (TCP/IP) the length of the received lists has no meaning, so the data has to be serialized anyhow
+ */
+void iemnet__streamout(t_outlet*outlet, int argc, t_atom*argv);
+
+
#if defined(_MSC_VER)
# define snprintf _snprintf
# define IEMNET_EXTERN __declspec(dllexport) extern
diff --git a/tcpclient.c b/tcpclient.c
index dec7983..850736c 100644
--- a/tcpclient.c
+++ b/tcpclient.c
@@ -215,7 +215,7 @@ static void tcpclient_receive_callback(void*y, t_iemnet_chunk*c, int argc, t_ato
if(argc) {
iemnet__addrout(x->x_statusout, x->x_addrout, x->x_addr, x->x_port);
- outlet_list(x->x_msgout, gensym("list"), argc, argv);
+ iemnet__streamout(x->x_msgout, argc, argv);
} else {
// disconnected
tcpclient_disconnect(x);
diff --git a/tcpreceive.c b/tcpreceive.c
index 10b688c..3dc6c9f 100644
--- a/tcpreceive.c
+++ b/tcpreceive.c
@@ -78,8 +78,8 @@ static void tcpreceive_read_callback(t_tcpconnection *y, int argc, t_atom*argv)
if(index>=0) {
if(argc) {
- // outlet info about connection
- outlet_list(x->x_msgout, gensym("list"), argc, argv);
+ // TODO?: outlet info about connection
+ iemnet__streamout(x->x_msgout, argc, argv);
} else {
// disconnected
int sockfd=y->socket;
diff --git a/tcpserver.c b/tcpserver.c
index e611551..d1be424 100644
--- a/tcpserver.c
+++ b/tcpserver.c
@@ -451,7 +451,7 @@ static void tcpserver_receive_callback(void *y0,
if(argc) {
tcpserver_info_connection(x, y);
- outlet_list(x->x_msgout, gensym("list"), argc, argv);
+ iemnet__streamout(x->x_msgout, argc, argv);
} else {
// disconnected
int sockfd=y->sr_fd;