User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v7.5.x:api:xatmi:tprecv.3

tprecv

Name

tprecv — Receive message from open conversation

Synopsis

#include <atmi.h>

int tprecv(int cd, char **data, long *len, long flags, long *revent);

For XATMI client link with -latmiclt -latmi -lubf -lnstd -lpthread -lrt -lm

For XATMI server link with -latmisrv|-latmisrvnomain|-latmisrvinteg -latmi -lubf -lnstd -lpthread -lrt -lm

DESCRIPTION

Receive message from open conversation, which is opened by tpconnect(). The incoming buffer data must be allocated with tpalloc(). If conversation receives disconnect (TPEV_DISCONIMM), service error (TPEV_SVCERR) or service failure (TPEV_SVCFAIL), then global transaction if one in progress is aborted.

Valid flags

TPSIGRSTRT Restart the system call in progress if interrupted by signal handler. This affects only underlying mq_* function calls.

TPNOTIME Ignore timeout setting (NDRX_TOUT env variable). Wait for reply for infinitely.

TPNOBLOCK Do not block on empty queue, if not messages present, the function returns immediately.

RETURN VALUE

On success, tprecv() return zero; on error, -1 is returned, with tperrno set to indicate the error. In case of event received, the error code is set to TPEEVENT.

revent return values:

TPEV_DISCONIMM Disconnect received from other conversation end, by issuing tpdiscon(). The global transaction in progress is aborted in this case. Connection descriptor cd is closed.

TPEV_SENDONLY The sender program issued tpsend() with flag TPEV_SENDONLY, meaning that we become senders.

TPEV_SVCERR Server died or tpreturn(3) failed. Connection descriptor cd is closed.

TPEV_SVCFAIL Server returned TPFAIL with tpreturn() Connection descriptor cd is closed.

TPEV_SVCSUCC Server did tpreturn() with TPSUCCESS, connection is closed automatically after this event. Connection descriptor cd is closed.

ERRORS

Note that tpstrerror() returns generic error message plus custom message with debug info from last function call.

TPEINVAL Invalid call descriptor cd passed in.

TPETIME Service did not reply in given time (NDRX_TOUT).

TPEEVENT Event received and it is installed into revent field.

TPEPROTO System level service failure. Server died during the message presence in service queue.

TPESYSTEM System failure occurred during serving. See logs i.e. user log, or debugs for more info.

TPEOS System failure occurred during serving. See logs i.e. user log, or debugs for more info.

EXAMPLE

See atmitest/test003_basicconvers/atmisv3.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd