Exemple #1
0
static void udpclient_free(t_udpclient *x)
{
    udpclient_disconnect(x);
    if(x->x_clock)clock_free(x->x_clock);
    x->x_clock=NULL;
    if(x->x_floatlist)iemnet__floatlist_destroy(x->x_floatlist);
    x->x_floatlist=NULL;
}
Exemple #2
0
static void udpclient_connect(t_udpclient *x, t_symbol *hostname, t_floatarg fportno)
{
  if(x->x_fd>=0)udpclient_disconnect(x);
  /* we get hostname and port and pass them on
     to the child thread that establishes the connection */
  x->x_hostname = hostname->s_name;
  x->x_port = fportno;
  x->x_connectstate = 0;
  /* start child thread */
  if(pthread_create(&x->x_threadid, &x->x_threadattr, udpclient_child_connect, x) < 0)
    error("%s: could not create new thread", objName);
}
Exemple #3
0
static void udpclient_receive_callback(void*y, t_iemnet_chunk*c) {
  t_udpclient *x=(t_udpclient*)y;

  if(c) {
    iemnet__addrout(x->x_statusout, x->x_addrout, x->x_addr, x->x_port);
    x->x_floatlist=iemnet__chunk2list(c, x->x_floatlist); // gets destroyed in the dtor
    outlet_list(x->x_msgout, gensym("list"),x->x_floatlist->argc, x->x_floatlist->argv);
  } else {
    // disconnected
    DEBUG("disconnected");
    if(x->x_fd >= 0) {
      udpclient_disconnect(x);
    }
  }
}