


CSEND(3)              iPSC(Reg.)/860 System              CSEND(3)



NAME
     CSEND - Send a message; block the calling process until the
     send completes.

SYNOPSIS
     #include <cube.h>

     csend(_t_y_p_e, _b_u_f, _l_e_n, _n_o_d_e, _p_i_d)

     long _t_y_p_e;
     char *_b_u_f;
     long _l_e_n, _n_o_d_e, _p_i_d;

ENVIRONMENT
     Host, Node

DESCRIPTION OF PARAMETERS
     _t_y_p_e      The type of the message being sent. Refer to
               Appendix A of the _i_P_S_C(_R_e_g.)/_8_6_0 _C _S_y_s_t_e_m _C_a_l_l_s
               _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l for information on selecting
               message types.

     _b_u_f       Pointer to the buffer that contains the message
               being sent. The buffer may be of any legal data
               type, but should match the data type of the buffer
               in the corresponding receive operation.

     _l_e_n       The size (in bytes) of the message. Message size
               is limited only by the memory available for the
               buffer.

     _n_o_d_e      The node to receive the message being sent.
               Setting _n_o_d_e to -1 sends the message to all nodes
               except the sending node. Nodes within a cube are
               numbered consecutively from 0.

     _p_i_d       The ID of the process to receive the message.
               (Always 0; other values ignored.)

DISCUSSION
     Use csend() to send a message and cause the calling process
     to wait until the send completes.

     Completion of csend() does not imply that the message was
     received by the destination process, only that the message
     was sent and that the buffer (_b_u_f) is available for reuse.

     This is a synchronous call. The calling process waits until
     the send completes. To send a message without blocking the
     calling process, use isend() (an asynchronous call) instead
     of csend().




Release 3.3.2        Last change: 3/17/1992                     1






CSEND(3)              iPSC(Reg.)/860 System              CSEND(3)



EXAMPLE
     The following example uses csend() to send the message from
     node 0 to node 1.

       #include <cube.h>

       long iam;
       main() {
       char msgbuf[80], smsg[80];

          iam = mynode();
          if(!iam) {
             sprintf(smsg,"Hello from node %d\n",iam);
             csend(100, smsg, strlen(smsg)+ 1, 1, 0);
             printf("Node %d sent: %s",iam,smsg);
          }
          else {
                crecv(100, msgbuf, sizeof(msgbuf));
                printf("Node %d received: %s\n",iam,msgbuf);
          }
       }

ERRORS
csend: Invalid type

     Use a non-negative number.

csend: Invalid length

     Use a non-negative number or a length less than or equal to
     maximum message length.

csend: Invalid node

     Use numnodes() to determine cube size.

csend: Buffer length exceeds allocation

     Make sure parameter length does not exceed buffer size.

csend: Not enough memory

     Make sure message buffer starts on a boundary that is a
     multiple of four, or make more memory available to this
     process.

csend: Invalid buffer pointer

     Specify a pointer that contains the address of a valid data
     buffer.





Release 3.3.2        Last change: 3/17/1992                     2






CSEND(3)              iPSC(Reg.)/860 System              CSEND(3)



csend: No pid defined

     Use setpid() in the host program to define a host process
     ID.

SEE ALSO
     cprobe(), crecv(), csendrecv(), iprobe(), irecv(), isend()













































Release 3.3.2        Last change: 3/17/1992                     3






