IP_Receive

Cogent API and Utilities: Version 4.1
Prev |  | Next

# `IP_Receive`

`IP_Receive` -- receives any message.

## Syntax

``int IP_Receive`(IP_Task* myself, IP_Msg* rmsg, IP_MsgInfo* msginfo);`

## Arguments

`myself`

  A task structure referring to the current process.

`rmsg`

  A message structure to hold the received message.

`msginfo`

  A structure to be filled with extra information.

## Returns

The type of the received message.

## Description

This function receives message of any form, and classifies them according to type. Relevant information about the sender is stored in the `msginfo` structure. A message can be one of the following types:

- `IP_GUI` means a GUI event occurred. No further processing is necessary.

- `IP_ASYNC` means an asynchronous message was received. No reply is necessary.

  - `msginfo->subtype = ST_DH_EXCEPTION`, `ST_DH_ECHO`, or other.

  - `msginfo->rcvid =` the queue pulse ID

- `IP_SYNC` means a synchronous message was received. A reply is necessary via a call to `IP_MsgInfoReply`.

  - `msginfo->rcvid =` the `rcvid` (QNX 6) or the `pid` (QNX 4/Linux)

- `IP_NONE` means `IP_Receive` returned without receiving a message. This is possible if the queue pulse is triggered, but the queued message is no longer available.

- `IP_ERROR` means an error occurred during `IP_Receive`, but defied classification.

  - `msginfo->rcvid = errno`

- `IP_SIGNAL` means `IP_Receive` exited due to a signal.

- `IP_PULSE` means a pulse was received. No reply is necessary.

  - `msginfo->rcvid =` the pulse ID.

- `IP_RAW` means a message from a task not using the Cascade IPC library was received. The message data is contained in `(void*)(rmsg->msg)`. A reply is required with a call to `IP_MsgInfoReplyRaw`.

  - `msginfo->rcvid =` the `rcvid` (QNX 6) or the `pid` (QNX 4/Linux)

- `IP_FD` means activity occurred on a file descriptor. No data has been read from the file descriptor.

  - `msginfo->rcvid =` the file descriptor.

## See Also

Receiving Messages and Events, `IP_ReceiveNonblock`

Prev | Home | Next
`IP_QueueWrite` | Up | `IP_ReceiveNonblock`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.