static void netsend_send(t_netsend *x, t_symbol *s, int argc, t_atom *argv) { if (x->x_sockfd >= 0) { if (netsend_dosend(x, x->x_sockfd, s, argc, argv)) netsend_disconnect(x); } }
static void netsend_free(t_netsend *x) { #ifdef ROCKBOX (void) x; #else netsend_disconnect(x); #endif }
static void netsend_send(t_netsend *x, t_symbol *s, int argc, t_atom *argv) { #ifdef ROCKBOX (void) x; (void) s; (void) argc; (void) argv; #else /* ROCKBOX */ if (x->x_fd >= 0) { t_binbuf *b = binbuf_new(); char *buf, *bp; int length, sent; t_atom at; binbuf_add(b, argc, argv); SETSEMI(&at); binbuf_add(b, 1, &at); binbuf_gettext(b, &buf, &length); for (bp = buf, sent = 0; sent < length;) { static double lastwarntime; static double pleasewarn; double timebefore = sys_getrealtime(); int res = send(x->x_fd, buf, length-sent, 0); double timeafter = sys_getrealtime(); int late = (timeafter - timebefore > 0.005); if (late || pleasewarn) { if (timeafter > lastwarntime + 2) { post("netsend blocked %d msec", (int)(1000 * ((timeafter - timebefore) + pleasewarn))); pleasewarn = 0; lastwarntime = timeafter; } else if (late) pleasewarn += timeafter - timebefore; } if (res <= 0) { sys_sockerror("netsend"); netsend_disconnect(x); break; } else { sent += res; bp += res; } } t_freebytes(buf, length); binbuf_free(b); } else error("netsend: not connected"); #endif /* ROCKBOX */ }
static void netsend_free(t_netsend *x) { netsend_disconnect(x); }
static void netsend_send(t_netsend *x, t_symbol *s, int argc, t_atom *argv) { if (x->x_fd >= 0) { char *buf, *bp; int length, sent; t_binbuf *b = 0; if (x->x_bin) { int i; buf = alloca(argc); for (i = 0; i < argc; i++) ((unsigned char *)buf)[i] = atom_getfloatarg(i, argc, argv); length = argc; } else { t_atom at; b = binbuf_new(); binbuf_add(b, argc, argv); SETSEMI(&at); binbuf_add(b, 1, &at); binbuf_gettext(b, &buf, &length); } for (bp = buf, sent = 0; sent < length;) { static double lastwarntime; static double pleasewarn; double timebefore = sys_getrealtime(); int res = (int)send(x->x_fd, bp, length-sent, 0); double timeafter = sys_getrealtime(); int late = (timeafter - timebefore > 0.005); if (late || pleasewarn) { if (timeafter > lastwarntime + 2) { post("netsend blocked %d msec", (int)(1000 * ((timeafter - timebefore) + pleasewarn))); pleasewarn = 0; lastwarntime = timeafter; } else if (late) pleasewarn += timeafter - timebefore; } if (res <= 0) { sys_sockerror("netsend"); netsend_disconnect(x); break; } else { sent += res; bp += res; } } if (!x->x_bin) { t_freebytes(buf, length); binbuf_free(b); } } else error("netsend: not connected"); }