


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



NAME
     CRECV - Receive a message; block the calling process until
     the receive completes.

SYNOPSIS
     #include <cube.h>

     crecv(_t_y_p_e_s_e_l, _b_u_f, _l_e_n)

     long _t_y_p_e_s_e_l;
     char *_b_u_f;
     long _l_e_n;

ENVIRONMENT
     Host, Node

DESCRIPTION OF PARAMETERS
     _t_y_p_e_s_e_l   The message type or set of message types to
               receive. 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
               building a _t_y_p_e_s_e_l mask.

     _b_u_f       Pointer to the buffer in which to store the
               received message. The buffer can be of any valid
               data type, but should match the data type of the
               buffer in the corresponding send operation.

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

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

     When the receive is complete, the message is stored in _b_u_f
     and the calling process resumes execution. To get more
     information about the message after it is received, use the
     info...() calls.

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

EXAMPLE
     The following program uses crecv() to receive the first
     message to arrive (of type 10) and store it in _m_s_g_b_u_f.

       #include <cube.h>
       #define INIT_TYPE 10




Release 3.3.2        Last change: 3/17/1992                     1






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



       long iam;
       main()
       {
       char msgbuf[80], smsg[80];
          iam = mynode();
          if(iam==0) {
             sprintf(smsg,"Hello from node %d\n",iam);
             csend(INIT_TYPE, smsg, strlen(smsg)+1, -1, 0);
             printf("Node %d sent: %s",iam,smsg);
          }
          else {
             cprobe(INIT_TYPE);
             if(infocount() <= sizeof(msgbuf))  {
                crecv(INIT_TYPE, msgbuf, sizeof(msgbuf));
                printf("Node %d received: %s\n",iam,msgbuf);
             }
          }
       }

ERRORS
crecv: Invalid length

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

crecv: Too many requests

     Use msgwait() for isend() or irecv() requests that are
     outstanding.

crecv: Buffer length exceeds allocation

     Make sure parameter length does not exceed buffer size.

crecv: Received message too long for buffer

     Make sure value of _l_e_n does not exceed the size of _b_u_f.

crecv: Invalid node

     Use numnodes() to determine cube size.

crecv: Invalid buffer pointer

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

crecv: No pid defined

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




Release 3.3.2        Last change: 3/17/1992                     2






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



SEE ALSO
     csend(), csendrecv(), infocount(), infonode(), infopid(),
     infotype(), irecv(), isend(), msgwait(), numnodes()

















































Release 3.3.2        Last change: 3/17/1992                     3






