RDP Program

This chapter describes RDP program components, environment configurations and compilations.

1. Overview

RDP (Real-time Data Processor) works as a server, similar to UCS. RDP is a process that is modified from a UCS-type process in a kernel level to send continuously changing data to clients rapidly and effectively.

RDP sends data to clients without passing through CLH. This enables far better performance in process occupations or process speeds than UCS when sending small volumes of data to multiple clients in short term intervals.

2. RDP Server Program Component

An RDP server program implements application logic using usermain() like a UCS program.

  • $(TMAXDIR)/lib/libsvrrs. so

    A library that contains the program main() and various RDP APIs. This must always be linked to compile an RDP program.

  • int tpsvrinit(int argc, char *argv[])

    This is executed once when a program starts. It mostly initializes global variables and implements a database connection in case of a Non-XA.

  • int tpsvrdone()

    This is executed once when a program is terminated. Mostly, this returns used resources and implements a database disconnection in case of a Non-XA.

  • int usermain(int argc, char *argv[])

    Actual application logic is implemented. An application process will be terminated after executing tpsvrdone() if the process is returned from usermain(), so mostly this part will be implemented as an infinite loop.

    An RDP server program does not require tpschedule() unlike a UCS server program. An RDP client program is like a UCS client program. Implement the program to receive unrequested messages using APIs such as tpsetunsol_flag(), tpsetunsol(), and tpgetunsol(). For more information, refer to Client Program.

3. RDP Environment Configuration and Compilation

3.1. Environment Configuration

To create a configuration file for RDP, set MINCLH and MAXCLH in a DOMAIN section to the same value. Set REALSVR in a NODE section to the name of a server and then set the rscpc item.

An actual server is unique in a node and other server processes send data to the actual server and then the actual server sends the data to the client. The service result value will be sent to the server from each server process and the number of channels to use must be set in rscpc.

In the SERVER section, the values of MIN and MAX are usually double those of MINCLH and MAXCLH. Set SVRTYPE to 'REALSVR.'

*DOMAIN
tmax1                 SHMKEY =70990, MINCLH=1, MAXCLH=1

*NODE
tmaxi1                TMAXDIR = "/home/navis/tmax",
                      APPDIR  = "/home/navis/tmax/appbin",
                      PATHDIR = "/home/navis/tmax/path",
                      TLOGDIR = "/home/navis/tmax/log/tlog",
                      ULOGDIR = "/home/navis/tmax/log/ulog",
                      SLOGDIR = "/home/navis/tmax/log/slog",
                      REALSVR = “real", rscpc = 16

*SVRGROUP
svg1                  NODENAME = "tmaxi1"
svg2                  NODENAME = "tmaxi1"

*SERVER
deal                  SVGNAME = svg2, MIN=1
real                  SVGNAME = svg1, MIN=2, MAX=2, SVRTYPE = REALSVR

*SERVICE
IN                    SVRNAME = deal
OUT                   SVRNAME = deal

3.2. Compilation

An RDP server program must be linked to an RDP library (libsvrrs.so) when it is compiled. The program must include $TMAXDIR/usrinc/ucs.h and TMAXLIBS in a Makefile must include –lsvrrs and –lpthread.

The following is a Makefile example to compile an RDP server program on 32-bit Solaris.

# Server makefile
TARGET  = $(COMP_TARGET)
APOBJS  = $(TARGET).o
SDLFILE  = demo.s

#Solaris
LIBS      = -lsvrrs -lpthread -lnodb -lsocket -lnsl
OBJS    = $(APOBJS) $(SDLOBJ) $(SVCTOBJ)
SDLOBJ  = ${SDLFILE:.s=_sdl.o}
SDLC    = ${SDLFILE:.s=_sdl.c}
SVCTOBJ = $(TARGET)_svctab.o
CFLAGS  = -O -I$(TMAXDIR)
APPDIR  = $(TMAXDIR)/appbin
SVCTDIR = $(TMAXDIR)/svct
LIBDIR  = $(TMAXDIR)/lib

#
.SUFFIXES : .c
.c.o:
$(CC) $(CFLAGS) -c $<
#
# server compile
#

$(TARGET): $(OBJS)
        $(CC) $(CFLAGS) -L$(LIBDIR) -o $(TARGET) $(OBJS) $(LIBS)
        mv $(TARGET) $(APPDIR)/.
        rm -f $(OBJS)
$(APOBJS): $(TARGET).c
        $(CC) $(CFLAGS) -c $(TARGET).c
$(SVCTOBJ):
        touch $(SVCTDIR)/$(TARGET)_svctab.c
        $(CC) $(CFLAGS) -c $(SVCTDIR)/$(TARGET)_svctab.c
$(SDLOBJ):
        $(TMAXDIR)/bin/sdlc -i ../sdl/$(SDLFILE)
        $(CC) $(CFLAGS) -c ../sdl/$(SDLC)
#
clean:
        -rm -f *.o core $(TARGET)

Makefile content may vary by operating system.