


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



NAME
     IRECV - Post a request to receive a message.

SYNOPSIS
     long irecv(_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;

RETURN VALUE
     A non-negative message ID for use in msgcancel(), msgdone(),
     or msgwait() system calls

                                 NOTE

          The number of message IDs is limited, and an error
          occurs when no message IDs are available for a
          requested asynchronous send or receive. Therefore, your
          program should release the message ID as soon as
          possible by calling msgwait(), msgdone(), or
          msgcancel().

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       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 irecv() to post a receive for a message of the specified
     type(s). The irecv() system call returns a message ID that
     you can use with the msgdone() and msgwait() system calls to
     determine when the receive completes (and the buffer
     contains valid data).

     After the receive completes (i.e., after msgwait() completes
     or msgdone() returns a 1), you can use the info...() calls
     to get more information about the message. The irecv() call
     does not affect the values returned by the info...() calls;



Release 3.3.2        Last change: 3/17/1992                     1






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



     it only posts a receive for a message.

     This is an asynchronous call. The calling process continues
     to run while the receive is being done. If your program
     needs the received data for further processing, it must do
     one of the following:

     o+ Use crecv() (a synchronous call) instead of irecv().

     o+ Use msgwait() to wait until the receive completes.

     o+ Loop until msgdone() returns a 1, indicating that the
       receive is complete.

EXAMPLE

       long iam;

       main() {

       long msgid;
       char smsg[80], rmsg[80];

          iam = mynode();
          sprintf(smsg,"Hello from node %d\n",iam);
          msgid = irecv(100, rmsg, sizeof(rmsg));
          csend(100, smsg,     strlen(smsg)+1 ,-1,0);

          msgwait(msgid);

          printf("%d: received: %s\n",iam,rmsg);
       }

ERRORS
irecv: Invalid length

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

irecv: Too many requests

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

irecv: Buffer length exceeds allocation

     Make sure parameter length does not exceed buffer size.

irecv: 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






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



irecv: No pid defined

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

See Also

     crecv(), infocount(), infonode(), infopid(), infotype(),
     isend(), isendrecv(), msgcancel(), msgdone(), msgwait()











































Release 3.3.2        Last change: 3/17/1992                     3






