UCM Unitec Home Page
      

Send Message to Client

 UciWrite(L)

Name   Environment   Synopsis   Description   Diagnostics   See also   Examples

Name

UciWrite

Environment

Unix, Win32 Cobol

Synopsis

COPY "UCI.CPY".

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

Description

UciWrite sends the content of the UCI-MSG message structure to the client process identified by UCI-SOCKET in UCI-PAR. The fields UCI-MSGBUF and UCI-MSGLEN of the UCI-MSG structure should hold the data and the length of the message to send. Typically each client request received through UciRead causes the server to send one or more response messages.

UciWrite 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_BADSOCK The socket has not been initialized by a call to UciConnect or UciOpen or the socket is not open (UCM-ERRNO 3).
UE_INTR The send process has been interrupted by a signal (9).
UE_CONNECT The socket has been closed (8).

Diagnostics

Upon successful completion UciWrite 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

UciInit, UciRead

Examples

 
COPY "UCI.CPY".

ACCEPT UCI-SOCKET FROM COMMAND-LINE.
CALL "UciInit".
CALL "UciOpen" USING UCI-PAR.
CALL "UciRead" USING UCI-PAR
                     UCI-MSG.
MOVE "Answer 1" TO UCI-MSGBUF.
MOVE 8 TO UCI-MSGLEN.
CALL "UciWrite" USING UCI-PAR
                      UCI-MSG.
MOVE "Answer 2" TO UCI-MSGBUF.
CALL "UciWrite" USING UCI-PAR
                      UCI-MSG.
...
MOVE "Alarm" TO UCI-MSGID.
MOVE "You have new mail" TO UCI-MSGBUF.
MOVE 13 TO UCI-MSGLEN.
CALL "UciWrite" USING UCI-PAR
                      UCI-MSG.
...

 

Back to top