com-library/libvcacom/vca_com.c
int init_vca_com(vca_com_t * com, 
		 const char * host_ip, 
		 const char * host_port, 
		 vca_com_addr * self,
		 vca_com_type type) {
  
  int socket = -3; // with host publishing socketid

  if(!com || !host_ip || !host_port) {
    return -1;
  }
  
  // initialize com data structure
  com->com = NULL;
  com->type = type;
  vca_com_cpy_addr(self, &com->self);

  // connect to host via memsharing library
  switch (type) {
  case VCA_COM_MEM_SHARING:
    com->com = init_vca_task_system(host_ip, host_port, &socket);
    break;
  case VCA_COM_MEM_SHARING_HOST:
    com->com = init_host_task_system(com->com, host_ip, host_port, &socket);
    break;
  case VCA_COM_ZMQ_SOCKET: 
    {
      vca_com_addr dst;
      memset(&dst, 0, sizeof(vca_com_addr));
      com->com = init_zmq_socket_to_host(host_ip, host_port);
      // send initial msg to establish socket
      vca_com_send_msg(com, &dst, NULL, 0, 0);
      break;
    }
  default:
    return -1;
  }
    
  return (com->com) ? 0 : -1;
}
// initialize communication to host specified by ip and port
initialize communication to host specified by ip and port
initialize communication to host specified by ip and port
int init_vca_com(vca_com_t * com, 
		 const char * host_ip, 
		 const char * host_port, 
		 vca_com_addr * self,
		 vca_com_type type) {
  int socket = -3; 
  if(!com || !host_ip || !host_port) {
    return -1;
  }
  com->com = NULL;
  com->type = type;
  vca_com_cpy_addr(self, &com->self);
  switch (type) {
  case VCA_COM_MEM_SHARING:
    com->com = init_vca_task_system(host_ip, host_port, &socket);
    break;
  case VCA_COM_MEM_SHARING_HOST:
    com->com = init_host_task_system(com->com, host_ip, host_port, &socket);
    break;
  case VCA_COM_ZMQ_SOCKET: 
    {
      vca_com_addr dst;
      memset(&dst, 0, sizeof(vca_com_addr));
      com->com = init_zmq_socket_to_host(host_ip, host_port);
      vca_com_send_msg(com, &dst, NULL, 0, 0);
      break;
    }
  default:
    return -1;
  }
  return (com->com) ? 0 : -1;
}
int init_vca_com ( vca_com_t * com , const char * host_ip , const char * host_port , vca_com_addr * self , vca_com_type type ) { int socket = -3 ; if ( ! com || ! host_ip || ! host_port ) { return -1 ; } com -> com = NULL ; com -> type = type ; vca_com_cpy_addr ( self , & com -> self ) ; switch ( type ) { case VCA_COM_MEM_SHARING : com -> com = init_vca_task_system ( host_ip , host_port , & socket ) ; break ; case VCA_COM_MEM_SHARING_HOST : com -> com = init_host_task_system ( com -> com , host_ip , host_port , & socket ) ; break ; case VCA_COM_ZMQ_SOCKET : { vca_com_addr dst ; memset ( & dst , 0 , sizeof ( vca_com_addr ) ) ; com -> com = init_zmq_socket_to_host ( host_ip , host_port ) ; vca_com_send_msg ( com , & dst , NULL , 0 , 0 ) ; break ; } default : return -1 ; } return ( com -> com ) ? 0 : -1 ; }
initialize communication to host specified by ip and port
initialize communication to host specified by ip and port
// with host publishing socketid // initialize com data structure // connect to host via memsharing library // send initial msg to establish socket