/* Copyright (C) 2002 Hayato Fujiwara This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include #include #include "defun-dld.h" #include "dirfns.h" #include "error.h" #include "help.h" #include "oct-map.h" #include "systime.h" #include "ov.h" #include "oct-obj.h" #include "utils.h" #include "oct-env.h" #include #include #include #include #include #include #include #include #define BUFF_SIZE SSIZE_MAX // COMM DEFUN_DLD (send, args, , "send (X,sockets)\n\ \n\ Send the variable 'x' to the computers specified by matrix 'sockets'.") { octave_value retval; typedef std::map::iterator iterator; typedef std::map::const_iterator const_iterator; if(args.length () ==2) { octave_value val=args(0); Matrix sock_m=args(1).matrix_value(); int sock,i,k,error_code,nl; int nsock=sock_m.rows(); int type_id=0; //=val.type_id(); if((int)sock_m.data()[0]==0){ int num,pid; struct pollfd *pollfd; pollfd=(struct pollfd *)malloc(nsock*sizeof(struct pollfd)); for(i=0;ih_name,hehe->h_name,hehe->h_name,pid ); } if(pollfd[k].revents&POLLERR){ error("Error condition - %s",hehe->h_name ); } if(pollfd[k].revents&POLLHUP){ error("Hung up - %s",hehe->h_name ); } } } } } if(val.is_real_matrix() && !(val.is_char_matrix())) { Matrix m=val.matrix_value(); int row=m.rows(); int col=m.columns(); int length=0,count,r_len; const double *tmp=m.data(); type_id=3; for (i=0;i