From 7ac448bb91b48fcc835c623272ef41cbbbba6d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Thu, 1 Apr 2010 07:20:58 +0000 Subject: convenience function for outputting the socket svn path=/trunk/externals/iem/iemnet/; revision=13329 --- iemnet.c | 14 +++++++++++--- iemnet.h | 11 +++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/iemnet.c b/iemnet.c index d35b8fe..bd8a15c 100644 --- a/iemnet.c +++ b/iemnet.c @@ -28,12 +28,20 @@ void iemnet__addrout(t_outlet*status_outlet, t_outlet*address_outlet, if(address_outlet)outlet_list (address_outlet, gensym("list" ), 5, addr); } -void iemnet__numconnout(t_outlet*status_outlet, t_outlet*numconn_outlet, int numconnections) { +void iemnet__numconnout(t_outlet*status_outlet, t_outlet*numcon_outlet, int numconnections) { t_atom atom[1]; SETFLOAT(atom, numconnections); - if(status_outlet )outlet_anything(status_outlet , gensym("connections"), 1, atom); - if(address_outlet)outlet_float (address_outlet, numconnections); + if(status_outlet)outlet_anything(status_outlet , gensym("connections"), 1, atom); + if(numcon_outlet)outlet_float (numcon_outlet, numconnections); +} + +void iemnet__socketout(t_outlet*status_outlet, t_outlet*socket_outlet, int socketfd) { + t_atom atom[1]; + SETFLOAT(atom, socketfd); + + if(status_outlet)outlet_anything(status_outlet , gensym("socket"), 1, atom); + if(socket_outlet)outlet_float (socket_outlet, socketfd); } diff --git a/iemnet.h b/iemnet.h index 7a97460..a484ccd 100644 --- a/iemnet.h +++ b/iemnet.h @@ -223,6 +223,17 @@ int iemnet__receiver_getsize(t_iemnet_receiver*); */ void iemnet__addrout(t_outlet*status_outlet, t_outlet*address_outlet, long address, unsigned short port); +/** + * output the socket we received data from + * the given socket is first output through the status_outlet as a "socket" message + * and then as a single number through the socket_outlet + * + * \param status_outlet outlet for general status messages + * \param socket_outlet outlet for sockets only + * \param sockfd the socket + */ +void iemnet__socketout(t_outlet*status_outlet, t_outlet*socket_outlet, int sockfd); + /** * output the number of connections * the given number of connections is first output through the status_outlet as a "connections" message -- cgit v1.2.1