User Tools

Site Tools


Sidebar

Table Of Contents

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

tpsend

Name

tpsend — Send message to open conversation

Synopsis

#include <atmi.h>

int tpsend(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

Send a message to open conversation, described by cd, which is opened by tpconnect(). The outgoing buffer data must be allocated with tpalloc(), if buffer is not self describing .e.g CARRAY, then len parameter must be correctly set. The data can be also set to NULL in that case len is not used.

Enduro/X does not terminate global transaction in case of send failure.

Valid flags

TPRECVONLY Signal the caller that we want to enter in listening mode. The other end will receive TPEV_SENDONLY event.

TPNOBLOCK Do not block the call if conversational queue is full.

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

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

TPNOTIME In case if blocking condition exists (queue full), wait indefinitely on queue to send msg.

RETURN VALUE

On success, tpcall() return zero; on error, -1 is returned, with tperrno set to indicate the error.

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(3) 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 or data pointer is not pointing to buffer allocated by tpalloc().

TPETIME Was unable to send message in given time(NDRX_TOUT env param.).

TPEEVENT Event received and it is installed into revent field.

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