ctSysQueueMlen
Retrieves the length of the next available message in the queue.
Short Name
ctSysQueueMlen()
Type
ISAM function.
Declaration
NINT ctSysQueueMlen(NINT qhandle, LONG timeout)
Description
ctSysQueueMlen() returns the length of the next available message in the specified queue.
Parameter qhandle is a system queue handle returned by a call to ctSysQueueOpen(). Parameter timeout specifies a millisecond time that ctSysQueueMlen() will block if the queue is empty. A timeout value of ctWAITDFOREVER will cause ctSysQueueMlen() to block until data is available in the queue.
Use ctSysQueueMlen() to find out the appropriate size of a buffer before calling ctSysQueueRead().
Return
ctSysQueueMlen() returns the length of the next available message, or a negative value on error.
Value |
Symbolic Constant |
Explanation |
---|---|---|
-7 |
TUSR_ERR |
Terminate user. |
-90 |
NQUE_ERR |
Could not create queue. |
-514 |
CQUE_ERR |
Queue has already been closed. |
See FairCom DB Error Codes for a complete listing of valid FairCom DB error values.
Example
NINT len = ctSysQueueMlen(qhandle, ctWAITFOREVER);
if (len >= 0)
printf("The next message length is %d bytes\n", len);
else
printf("ctSysQueueMlen failed with code %d\n", -len);
Limitations
Client/Server mode only.
See also
ctSysQueueRead