UCM Unitec Home Page
      

Receive Client Data

 UciRead(L)

Name   Environment   Synopsis   Description   Diagnostics   See also   Examples

Name

UciRead

Environment

Unix, Win32 Cobol

Synopsis

COPY "UCI.CPY".

CALL "UciRead" USING UCI-PAR
                                          UCI-MSG.

Description

The UciRead function reads the next client message from the socket UCI-SOCKET in UCI-PAR, initialized through UciConnect . The maximum size of the message ID and the message data are stored in the fields UCI-IDSIZE and UCI-MSGSIZE respectively. If the buffers provided are too small to hold the full ID or message data, the values received will be truncated. The truncated parts of the message are lost and no indication of the truncation is given to the calling process.

UciRead will fail if one or more of the following is true:

UE_NOTINIT The UCI interface has not been initialize by a call to UciInit (UCI-ERRNO 1).
UE_INVALID The value of UCI-IDSIZE or/and UCI-MSGSIZE is invalid (2).
UE_BADSOCK The socket has not been initialized by a call to UciConnect or UciOpen (3).
UE_CONNECT The socket identifier UCI-SOCKET has been removed, i.e. the connection has been terminated by the client (8).
UE_NOMSG No message was available when the read was cancelled, e.g. by a signal (5).

Diagnostics

Upon successful completion UciRead returns ZERO. Otherwise, the value of the  global ucmErrno is returned and the field UCI-ERRNO in the UCI-PAR structure is set to indicate the error. In most Cobol implementations the return code of C functions may be accessed through a predefined variable named RETURN-CODE.

See also

UciConnect, UciOpen

Examples

 
COPY "UCI.CPY".

ACCEPT UCI-SOCKET FROM COMMAND-LINE.
CALL "UciInit".
CALL "UciOpen" USING UCI-PAR.
CALL "UciRead" USING UCI-PAR
                     UCI-MSG.
...

 

Back to top