Middleware

[TUXEDO] BLOCKTIME 테스트

2022. 9. 6. 17:12

BLOCKTIME 이란 Blocking 메세지에 대한 Timeout값 입니다.

 

BLOCKTIME은 SCANUNIT * BLOCKTIME 값으로 지정됩니다

.

 

SCANUNIT 5(초) 

BLOCKTIME 12(초)

 

라고 한다면,

 

BLOCKTIME 값은 60(초)으로 지정됩니다.

 


BLOCKTIME이 되면 timeout 에러가 나옵니다.

 

Tuxedo의 timeout 에러는 tperrono = 13 입니다.

 


tperrono =13  에러는 서비스를 요청하고 응답 받을 때 까지의 시간이, BLOCKTIME을 초과 하였을 때 발생하는 에러입니다.

 

 


 

테스트 진행을 위해서 AP server의 sleep 값으로 65를 주고 진행했습니다.

BLOCKTIME 설정값은 60(초) 입니다.

 

아래와 같이 sleep으로 준 값 65초가 지난 후 

아래와 같이 Tperrno = 13 에러가 납니다.

 

 

 

반면에 sleep 값으로 45초를 주었고 

아래와 같이 BLOCKTIME 에러가 발생하지 않고 

정상적으로 서비스 호출이 되었습니다.

 

 

 

oracle tuxedo

 

테스트환경 : IBM AIX 7.2

 


 

이번 테스트는 패치 구버전에서 최신버전으로 패치를 진행하고, 다시 rollback 하여 구패치버전으로 돌아가는지 확인하기 위한 테스트 입니다.

 

테스트의 결과부터 말씀드리자면 

 

tmadmin -v 명령어로 patch 버전을 확인하였을 때 

 

patch level (003) ----patch----> patch level (091) ----rollback---> patch level (none)  이라는 결과가 나오고 

 

patch level (087) ----patch----> patch level (091) ----rollback---> patch level (087) 이라는 결과가 나옵니다.

 

 

구버전들의 차이점은 RP이고 RP가 아니라는 점입니다.

 

 

 

차이점은 이정도로 알고 있습니다.

 

보통 최신버전으로 패치를 한 상태에서 rollback을 시키면 최신패치 이전으로 되돌아가 있는 게 정상? 이라고 합니다.

 

 

 

 

알고 계시는 부분이 있으시다면 댓글 부탁드립니다! 

함께 공부하고 싶습니다.


1. 현재 버전 패치 상태를 확인할 수 있는 명령어를 사용하여 버전을 확인합니다.

   (일부러 구버전으로 패치를 시켜놨습니다)

 

 

2. 이제 최신버전으로 패치를 해보겠습니다.

 

 

패치가 정상적으로 진행되는 것 같습니다.

 

구버전을 rollback 시키고 

최신버전을 패치중이라고 하네요.

 

한가지 워닝이 났는데, 나중에 살펴 보겠습니다.

패치가 잘 진행된 것 같습니다.

 

패치를 확인해보니 달라졌네요. 최신버전인 것 같습니다.

 


그렇다면 여기서 다시 rollback 하면 과연 이전 패치로 돌아갈까요?

 

반대로 이 부분을 반대로 테스트 해보겠습니다.

 

rollback을 진행합니다.

 

 

rollback이 성공되었습니다.

과연 이전 패치버전으로 돌아가있을까요?

 

 

이제 확인해보겠습니다.


 

패치가 돌아가지 않고 패치가 아예 안된 상태로 돌아가있습니다.

 

이번 테스트를 통해서 구버전에서 최신버전으로 패치를 한 후 다시 이전 패치로 돌아가기 위한 상황에서 rollback 을 하였을 때, 다시 돌아가지 않고 디폴트가 된다는 것을 알 수 있게 되었습니다.

 

 

 

 

오늘의 테스트는 이것으로 마치겠습니다.

 

감사합니다.

 

 

 

 

 

 

 

 

 

 

 

 

궁금한 점은 댓글부탁드립니다!

함께 공부하고 싶습니다.

 

테스트환경 : IBM AIX 7.2 

테스트장비 : IBM AIX, LINUX

 

 

stderr = standard error 

 

------

 

ubbconfig에서 환경설정을 해줍니다.

 

 

IPCKEY          123457

DOMAINID        simpapp
MASTER          simple
MAXACCESSERS    1000
MAXSERVERS      100
MAXSERVICES     500
MODEL           SHM
LDBAL           Y

*MACHINES
DEFAULT:

                APPDIR="/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp"
                TUXCONFIG="/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp/tuxconfig"
                TUXDIR="/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0"
                MAXWSCLIENTS=800


node1   LMID=simple

*GROUPS
WSLGRP1
        LMID=simple GRPNO=1  OPENINFO=NONE

WSLGRP2
        LMID=simple GRPNO=5  OPENINFO=NONE

GROUP1
        LMID=simple GRPNO=2  OPENINFO=NONE

GROUP2
        LMID=simple GRPNO=3  OPENINFO=NONE



*SERVERS
DEFAULT:        RESTART=Y       REPLYQ=Y
                 CLOPT="-A"

WSL     SRVGRP=WSLGRP1 SRVID=2000
        MAXGEN=255      GRACE=86400
        CLOPT="-A -- -n //211.110.82.xxx:5500 -p 5501 -P 5599  -w WSH -t 15 -m 3 -M 10 -x 10"

WSL     SRVGRP=WSLGRP2 SRVID=3000
        MAXGEN=255      GRACE=86400
        CLOPT="-A -- -n //211.110.82.xxx:5600 -p 5601 -P 5699  -w WSH -t 15 -m 3 -M 10 -x 10"

simpserv        SRVGRP=GROUP1 SRVID=100
                CLOPT="-A -r -o /ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp/stdout -e /ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp/stderr"
                RQADDR="test"
                RQPERM=0600 MIN=2 MAX=30 SECONDARYRQ=N REPLYQ=Y   CONV=N
                MAXGEN=255      GRACE=86400


simpserv2       SRVGRP=GROUP2 SRVID=200
                CLOPT="-A -r -o /ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp/stdout2 -e /ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp/stderr2"

                RQADDR="test2"
                RQPERM=0600 MIN=3 MAX=30 SECONDARYRQ=N REPLYQ=Y   CONV=N
                MAXGEN=255      GRACE=86400

*SERVICES
TOUPPER

 

 

 

 

 

 

1. simpserv.c 파일에서 sleep을 걸어두어 수행시간 조절을 하였습니다.

 

 

2. simpserv.c를 변경해주었으면 다시 컴파일을 진행해야합니다.

서버가 내려간 상태에서 해주어야 합니다.

저는 이미 내린 상태라 BB에 연결되지 않았다고 하네요.

tmshutdown -s simpserv

 

 

3. 컴파일을 진행해줍니다.

 

 buildserver -o simpserv -f simpserv.c -s TOUPPER

 

 

4. 이제 클라이언트에서 서비스를 호출해봅니다.

 

정확히 3초 후에 서비스가 호출됩니다.

 

 

 

 


이제 호출한 서비스의 평균 수행시간을 알아보겠습니다.

 

 

서비스 수행시간을 호출하는 명령어는 txrpt 입니다.

 

"txrpt -d mm/dd -s hh:mm -e hh:mm < stderr파일 "
          -----    -----    -----   ------

ex) txrpt -d 9/7 -s 14:00 -e 14:30 < tmstderr > rpt.txt

rpt.txt" 는 조회 내용을 rpt.txt 파일로 만든다는 내용인데요 생략 하시면 화면에 디스플레이 됩니다.
txrpt -d 확인하고싶은날짜 -s 시작시간 -e 끝나는시간 < 정보를 띄워놓을 파일명

 

 

다시 서버로 돌아가서 txrpt 테스트를 진행해보겠습니다.

명령어를 수행하면 아래와 같습니다.

 

저는 시간설정 없이 해주었기 때문에 9/5 테스트중 서비스호출내용이 모두 나오게 되었습니다.

 

TOLOWER 서비스의 수행시간도 알아볼까요?

 

위와 같은 방법으로 수행시간을 3초로 sleep 준 후 서버를 다시 컴파일 해주었습니다.

 

서비스 호출 수행시간 확인

 

 

 

이상입니다.

 


# Examples

The above example shows that SVC1 was requested a total of six times within the specified period and that it took an average of 0.37 seconds to process the request.

 

 

 

 

 

 

 

참고자료

 

https://docs.oracle.com/cd/E72452_01/tuxedo/docs1222/rfcm/rfcmd.html#1002357

 

[TUXEDO] Patch

2022. 9. 5. 16:33

Tuxedo 12.2.2.0.0 패치 

 

최신 버전 패치를 진행하였습니다.

 

*************************************************************************************************************

다음 포스팅으로는 구패치버전에서 신패치버전으로 패치를 해보는 테스트를 진행해보겠습니다.

*************************************************************************************************************

 

패치

 

 

1. MOS에 로그인 후 Patches&Updates 플랫폼을 선택합니다.

 

2. 제품과 릴리즈 버전 및 설치장비를 선택해줍니다.

 

 

 

3. 받은 zip 파일을 AIX 서버로 옮겨야합니다. 이 때 저는 SFTP로 전송해주었습니다.

생소하신 분은 이전 글을 참고해주세요 !

https://nomajorkorean.tistory.com/3

 

[LINUX] SFTP (Secure File Transfer Protocol) 의 명령어를 활용한 파일 전송

업무를 하다보면 Window OS에서 Linux OS로 또는 반대방향으로 파일이 빈번히 오고 갈 수 있다. (리눅스는 오픈소스 소프트웨어이기 때문에 가능) 원격서버로 파일 전송을 하는 방법 중 한가지인 SFTP

nomajorkorean.tistory.com

 

 

 

4. 저는 patch 디렉토리를 따로 만들어서 이곳으로 떨어뜨렸습니다.

받은 zip파일을 unzip 해주면 .zip 패치파일이 생깁니다.

 

 

5. 패치 명령어는 다음과 같습니다 

 

저는 opatch 실행파일이 있는 OPatch 디렉토리에서 설치를 진행하였기 때문에 패치파일zip을 가져오기위해서 절대경로를 사용했습니다. -invPtrLoc는 oraInst.loc 파일의 위치를 나타내주는 파라미터 입니다. oraInst.loc의 절대경로를 설정해줍니다.

 

 

./opatch apply /ofm/jwchoi/sw/tp/patch/34182899.zip -invPtrLoc /ofm/jwchoi/sw/tp/oraInventory/oraInst.loc

 

위와  같은 명령어로 엔터를 치면 패치를 진행하게 됩니다.

 

<패치가 진행되는 모습>

 

Return Code = 0 

 

이 나오면 설치가 성공적으로 진행된 것 입니다.

 

 

 


패치 확인

 

다음은 패치를 확인하는 명령어를 사용해서 패치를 확인해보겠습니다.

 

./opatch lsinventory -invPtrLoc /ofm/jwchoi/sw/tp/oraInventory/oraInst.loc

 

lsinventory는 패치를 확인해주는 명령어 입니다.

 

위 명령어를 실행시켜주면 아래와 같은 화면이 나타나게 됩니다.

 


 

 

Rollback 

 

다음은 패치를 rollback 시키는 테스트를 해보겠습니다.

 

명령어는 다음과 같습니다.

 

 ./opatch rollback -id 34182899 -invPtrLoc /ofm/jwchoi/sw/tp/oraInventory/oraInst.loc

 

패치와 패치확인 명령어와 달리 id 값을 주는 파라미터가 들어가게 됩니다.

 

 

<rollback 확인 화면>

 

 

 

이상으로 tuxedo patch에 대해서 알아보았습니다.

 

(Queue)에 관한 정보를 출력

 

printqueue(pq) [qaddress]

 

참고) 파라미터

 

Prog Name  : 서버 어플리케이션의 이름.

Queue Name : (Queue)의 이름은 'GRPNO.SRVID'로 나타나며 만약 어떤

             서버 어플리케이션이 MSSQ를 사용한다면 RQADDR에 설정된

             큐(Queue)의 이름이 출력.

#Queued    : (Queue)에 쌓인 서비스 요구 수.

Wk Queued  : 서버 어플리케이션을 위해 Queuing된 현재의 Load.

Ave.Len    : (Queue)의 평균 길이.

 

* psr

 

서버 어플리케이션에 의해 수행된 작업에 관한 정보를 출력

('RqDone' 'Load Done' 은 시스템이 부팅된 시점부터 계속 누적값)

 

printserver(psr) [-m lmid] [-g groupname] [-i srvid] [-q qaddress]

 

 

 

 

 

 

* psc

 

서비스 수행에 관한 더 자세한 정보를 출력

printservice(psc) [-m lmid] [-g groupname] [-i srvid]

                    [-a {0 | 1 | 2}] [-q qaddress] [-s service]

이번 테스트는 장비 2곳 (클라이언트)에서 장비 1곳 (서버) 간 서비스를 호출하는 것으로 진행해보았습니다.

 

 

 

테스트 환경 : IBM AIX 7.2 , Oracle Linux 7.9

테스트 장비 : AIX 1번 장비 (server) , 2번 장비 (client) , LINUX  (client)   

 


 

진행 방법 

 

AIX 1번 장비는 서비스를 제공하는 Server로서 Client(AIX 2번 장비, Linux)와 접속을 하기 위한 WSL 프로세스를 두 개 띄웠습니다.

WSL은 클라이언트와 서버 간 통신의 역할을 하는 프로세스 입니다. TCP/IP와 같습니다.

또한 실질적인 서비스를 가지고 있는 AP server 프로세스를 두개 띄우는 작업을 하였습니다.

각각의 서버에는 TOUPPER와 TOLOWER  서비스를 가지고 있습니다.

 

Client(AIX 2번 장비, Linux)는 Server(AIX 1번 장비)로 접속하기 위해 WSNADDR이라는 환경변수를 설정해주어야 합니다. 

 

WSLADDR = //ip:port

이렇게 들어가고 싶은 서버의 주소와 포트에 해당하는 WSL에 socket을 연결을 하여 서버(AIX 1번 장비)와의 접속을 요청하게 되는 것이죠.

 

이 로직구성이 성공적으로 마치게 되면 클라이언트는 서버에 socket 연결이 되는 것이고 

함수를 이용해 서비스를 호출을 할 수 있답니다.

 

 

더 이해하기 쉬우시도록 테스트 환경파일을 보여드리겠습니다.

 

 

 


 

 

 

 

 

1. 서버에서 클라이언트와 접속을 하기위해서는 가장 먼저 환경파일을 설정해주어야합니다.

tuxedo의 모든 구성은 ubbconfig 라는 환경변수 파일을 사용하여 구성하게 됩니다.

 

아래 코드도 모두 ubbconfig 환경변수파일 내 코드 입니다.

 

WSL (WorkStation Listener) 은 앞서 말씀드렸다시피 외부에서 접속하는 Client를 위해 TCP/IP 역할을 하는 통신 프로세스 입니다.

 

저는 외부에서 접속할 두 Client를 위해 WSL 포트를 두 곳으로 설정해주었습니다.

 

보통 포트의 범위는 달라야합니다. 이유는 무수히 많은 클라이언트가 WSL을 통해서 서버로 접속하게 될 경우 

클라이언트 간 접속포트가 겹치게 되면 분명 에러가 날 것이기 때문입니다. 그러한 에러를 방지하기 위함으로 생각하시면 편합니다.

 

*RESOURCES
IPCKEY          123457

DOMAINID        simpapp
MASTER          simple
MAXACCESSERS    1000
MAXSERVERS      100
MAXSERVICES     500
MODEL           SHM
LDBAL           Y

*MACHINES
DEFAULT:

                APPDIR="/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp"
                TUXCONFIG="/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp/tuxconfig"
                TUXDIR="/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0"
                MAXWSCLIENTS=800


node1   LMID=simple

*GROUPS
WSLGRP1
        LMID=simple GRPNO=1  OPENINFO=NONE

WSLGRP2
        LMID=simple GRPNO=5  OPENINFO=NONE

GROUP1
        LMID=simple GRPNO=2  OPENINFO=NONE

GROUP2
        LMID=simple GRPNO=3  OPENINFO=NONE



*SERVERS
DEFAULT:        RESTART=Y       REPLYQ=Y
                 CLOPT="-A"

WSL     SRVGRP=WSLGRP1 SRVID=2000
        MAXGEN=255      GRACE=86400
        CLOPT="-A -- -n //211.110.82.xxx:5500 -p 5501 -P 5599  -w WSH -t 15 -m 3 -M 10 -x 10"

WSL     SRVGRP=WSLGRP2 SRVID=3000
        MAXGEN=255      GRACE=86400
        CLOPT="-A -- -n //211.110.82.xxx:5600 -p 5601 -P 5699  -w WSH -t 15 -m 3 -M 10 -x 10"

simpserv        SRVGRP=GROUP1 SRVID=100
                RQADDR="simpserv_q"
                RQPERM=0600 MIN=2 MAX=30 SECONDARYRQ=N REPLYQ=Y   CONV=N
                MAXGEN=255      GRACE=86400


simpserv2       SRVGRP=GROUP2 SRVID=200
                RQADDR="simpserv2_q"
                RQPERM=0600 MIN=3 MAX=30 SECONDARYRQ=N REPLYQ=Y   CONV=N
                MAXGEN=255      GRACE=86400



*SERVICES
TOUPPER

 

 

 

 

2. 서버가 포트를 열어줬으니 이제 client는 그 포트를 타고 서버로 들어가야 합니다. WSL을 타고 들어가겠죠?

앞서 말씀드렸듯이 클라이언트는 WSNADDR 이라는 환경변수를 설정하여 WSL로 진입하여야합니다.

 

1번 클라이언트 => export WSNADDR=//211.110.82.xxx:5500 

2번 클라이언트 => export WSNADDR=//211.110.82.xxx:5600

 

클라이언트가 이렇게 변수를 설정하게 되면 tpinit() 이라는 함수를 사용하여 서버와의 접속을 요청하게 되고

 

요청받은 WSL은 서비스를 통신하는 역할을 하는 WSH(WorkStation Handler)와 연결을 하게 됩니다.

이렇게 ( client -> WSL -> WSH) socket이 연결이 된다면 !

 

client는 tpcall() 함수를 사용하여 서비스를 호출하게 됩니다.

서비스를 호출하게 된다면 WSH는 해당하는 서비스를 가지고 있는 AP server의 정보를 찾기 위하여 Bulletin Board에서 찾습니다.

 

그리고 해당 APserver로 서비스를 요청하게 되고 그 결과를 WSH로 return 하게 되며 WSH는 해당 클라이언트에게 서비스를 보내게 됩니다.

 

 


결과 

 

 

 

AIX 2번 장비에서 TOLOWER 서비스 성공적으로 호출 

 

 

Linux 장비에서 TOUPPER 서비스 성공적으로 호출

 

 

 

 

 

 

 

 

 

미들웨어는

클라이언트와 서버 간의 통신을 담당하는 시스템 소프트웨어 또는 컴퓨터와 컴퓨터의 연결을 담당하는 시스템 소프트웨어 라고 합니다.

 

짐작하셨겠지만 MiddleWare는  Middle + Software 합성어 입니다.

 


 

그렇다면 미들웨어는 어떤 역할을 할까요?

MiddleWare는 클라이언트 프로그램과 서버 프로그램 사이에 존재하면서 클라이언트와 서버간에 연결을 유지/관리하면서, 클라이언트의 작업 처리 요구를 서버에 전달하는 역할을 담당합니다.

 


 

 

 

많은 미들웨어 제품군 중

Tuxedo는 OS 환경 위에서 돌아가는 TP-Monitor 입니다.

메인 프레임 환경에서 운영되는 OLTP 업무를 UNIX 환경에서 운영 가능하게 하는 솔루션이자 

다양한 온라인 업무에 사용 실적을 갖고있는 TP 모니터이죠.

 

분산, 미션-크리티컬(mission-critical)한 어플리케이션을 단일 환경으로 설계, 구성, 관리 가능 하게 한답니다.

IBM 메인프레임에서 CICS가 TP-모니터라고 한다면, TUXEDO는 오픈 분산분산 환경에서의 온라인 TP-Monitor라고 볼 수 있습니다. 

 

보통 전세계적으로 증권사들 대부분이 Tuxedo 미들웨어를 사용한다고 합니다.

 

 

장애가 적고 업무 처리가 빠르다는 특징 때문인 것 같아요.


간단히 요약해보면

 

Tuxedo는 Client / Server  프로세스 간 통신의 역할을 하는 미들웨어 입니다.

 

 

(보통 시작 프로세스는 Client이고, 통신을 받는 프로세스는 Server입니다)

 

 

 

 

 

 

 

CMDGW_CAT:1931: ERROR: Write to gateway log failed

 

발생원인 => domconfig에서 DMTLOGSIZE를 변경하고 dmloadcf를 수행하였으나 실제 DMTLOG를 재 생성하지 않아 발생한 메시지

 

조치사항 => Domconfig에서 DMTLOGSIZE 변경후 반드시 DMTLOG를 재생성해 주어야함.(부팅시 자동으로 생성해 주므로 기존 DMTLOG만 제거해주면 됨)

 

 

 

CMDGW_CAT:2079: ERROR: Domain administrative service ..DMMIB not advertised: Can't get configuration

 

DMADM이 부팅 되어 있지 않아 GWADM이 booting되지 못함.

 

=> DMAMD 부팅후 GWADM booting

 

 

 

CMDTUX_CAT:1113: ERROR: Must be the administrator to execute this command

 

권한이 없는 유저로 tmshutdown실행

 

=> Admin user로 tmshutdown 실행

 

 

 

CMDTUX_CAT:1373: ERROR: Abnormal disconnect from pcorap2:

 

Pcorap2 Tuxedo를 내리기 위해 ipcrm을 사용하여 ipc자원을 remove한 상태임.

 

=> 없음

 

 

 

CMDTUX_CAT:1386: ERROR: BBL broadcast send failure, machine= COR1 tperrno = 7 opcode = 0x1d000017:                                

 

Shutdown중..ipc자원을 remove한 상태임

 

=> 없음

 

 

 

CMDTUX_CAT:1390: ERROR: BBL broadcast service failure, machine= COR2 opcode= 0x1d000017:                                           

 

Shutdown중..ipc자원을 remove한 상태임

 

=> 없음

 

CMDTUX_CAT:1391: ERROR: BBL broadcast RPC failure, machine=COR2, opcode=0x1d000010:                                       

 

BBL이 DBBL의 request를 처리할수 없음.

새 BB Download가 요청됨.

 

=> BB Download가 정상적으로 처리되면 자른 조치사항은 없음.

 

CMDTUX_CAT:1394: ERROR: BBL partitioned, machine= COR1:                                                                            

 

Shutdown중..ipc자원을 remove한 상태임

 

=> 없음

 

CMDTUX_CAT:1410: ERROR: Could not mark receive queue:                                                                                

 

다른 BSBRIDGE나 BRIDGE가 있기 때문에 초기화를 실패함.

 

=> 다시 tmboot 하거나 tmshutdown으로 cleanup한다.

 

 

CMDTUX_CAT:1414: ERROR: Could not shut down BSBRIDGE:                                                                                 

 

BSBRIDGE를 내리기 위한 message를 보내는데 실패함.

 

=> BSBRIDGE를 내리기 위해 tmshutdown 실행. 안되면 kill -9로 제거

 

 

 

CMDTUX_CAT:1422: ERROR: failed to restart administrative server, rescheduling restart

 

DBBL Restart시 TM_RESTARTTIMEOUT(30) 옵션에 의해 정상적인 restart가 되지 못함.사용자 개입이 필요.

 

=> DBBL 마이그레이션이 아직 완료되지 않은 상태임.

 

 

CMDTUX_CAT:1427: ERROR: Shutting down BBL due to removal of message queue:

 

ipcrm으로 BBL의 message queue를 제거한 상태

 

=> 해당 Node의 ipc자원을 확인하고 reboot

 

 

CMDTUX_CAT:1443: ERROR                                                                                       

 

Tmshutdown시 에러발생.

보통은 해당 서버가 부팅이 안되어 있는 상태임

 

=> 해당 서버의 부팅여부 확인

 

CMDTUX_CAT:1576: ERROR: No NLS available for remote machine COR2

 

Remote machine에 tlisten이 기동되지 않았을 때 발생

 

Tlisten 기동후 다시 수행

 

CMDTUX_CAT:1578: ERROR: Could not contact NLS on COR1:   

                                                                                                                                                                                                Remote machine에 tlisten이 기동되지 않았을 때 발생

 

Tlisten 기동후 다시 수행

 

 

CMDTUX_CAT:1579: ERROR: Network error contacting NLS on COR2:

 

 COR2의 tlisten과 통신할수 없음.

 

=> Tlisten상태 확인

 

 

CMDTUX_CAT:1590: ERROR: Unknown network error receiving reply from TAGENT on COR2:                                       

 

Network 에러로 remote machine의 tlisten과 접속하지 못함. 보통 초기 접속후에(tlisten) 가용하지 않은 상태로 되어 있는 상태

 

=> Network 및 remote machine의 상태 확인 

 

 

 

CMDTUX_CAT:1597: ERROR: Unable to unregister - remote procedure call failure - can't send request - TPEOS - operating system error:

 

Shutdown중..ipc자원을 remove한 상태임

 

=> 없음

 

 

CMDTUX_CAT:1714: ERROR: Send failure on TUXCONFIG propagation to COR2

 

tlisten이 기동되어 있지 않음.

 

 

=> tlisten기동후 재시도

 

 

 

CMDTUX_CAT:1860: ERROR: On restart, server process ID 11940020 failed to initialize within 30 seconds

 

TM_RESTARTTIMEOUT(30) 옵션에 의해 정상적인 restart가 되지 못함.

사용자 개입이 필요.

 

=> 없음.

 

 

CMDTUX_CAT:1860: ERROR: On restart, server process ID 5247030 failed to initialize within 5 seconds

 

DBBL Restart시 TM_RESTARTTIMEOUT(30) 옵션에 의해 정상적인 restart가 되지 못함.

사용자 개입이 필요.

 

=> DBBL 마이그레이션이 아직 완료되지 않은 상태임.

 

tuxedo는 TOUPPER 서비스를 함수로 저장해놨습니다. 

 

.c 로 되어있는 파일을 실행모듈로 만들어야 서비스 호출이 가능해집니다.

 

ex )

simpserv.c

 

buildserver -o simpserv -f simpserv -s TOUPPER

 

 

그렇다면 TOLOWER는 안될까요?

 

이 부분에 대한 테스트를 진행해보죠. 

 

 

 

 

 

 

1. ubbconfig 파일에서 TOLOWER 서비스를 가질 AP 서버를 만듭니다.

 

 

*RESOURCES
IPCKEY          123457

DOMAINID        simpapp
MASTER          simple
MAXACCESSERS    500
MAXSERVERS      50
MAXSERVICES     100
MODEL           SHM
LDBAL           N

*MACHINES
DEFAULT:

                APPDIR="/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp"
                TUXCONFIG="/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp/tuxconfig"
                TUXDIR="/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0"
                MAXWSCLIENTS=400


node1   LMID=simple

*GROUPS
WSLGRP
        LMID=simple GRPNO=1  OPENINFO=NONE

GROUP1
        LMID=simple GRPNO=2  OPENINFO=NONE

GROUP2
        LMID=simple GRPNO=3  OPENINFO=NONE

*SERVERS
DEFAULT:
                CLOPT="-A"

WSL     SRVGRP=WSLGRP SRVID=200

        CLOPT="-A -- -n //211.110.82.xxx:5500 -p 5501 -P 5599  -w W
SH -t 15 -m 20 -M 30 -x 10"

simpserv        SRVGRP=GROUP1 SRVID=1

simpserv2       SRVGRP=GROUP2 SRVID=2

 

 

2. buildserver로 simpserv.c 파일을 컴파일 해줘야합니다.

 

(buildserver -o 생성할 실행모듈의 이름 -f .c파일 -s 서비스명)

 

simpserv.c 를 simpserv2 실행모듈로 컴파일 해줍니다.

 

buildserver -o -simpserv2 -f simpserv.c -s TOLOWER

 

 

 

하지만 에러가 나올 것입니다.

 

또한 simpserv.c 는 TOUPPER 서비스를 함수 형태로 가지고 있는 파일이기 때문에 

만들어진 실행모듈 simpserv2 로는 TOLOWER 서비스를 호출하지 못할 것입니다.

 

저 코드를 실행하였을 때 

나오는 에러는 다음과 같습니다.

 

[node1@jwchoi:/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp]# buildserver -o simpserv2 -f simpserv.c -s TOLOWER
BS-185029c.c:
simpserv.c:
ld: 0711-224 WARNING: Duplicate symbol: tpsvrinit
ld: 0711-224 WARNING: Duplicate symbol: .tpsvrinit
ld: 0711-224 WARNING: Duplicate symbol: .userlog
ld: 0711-224 WARNING: Duplicate symbol: userlog
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
ld: 0711-317 ERROR: Undefined symbol: TOLOWER
CMDTUX_CAT:1832: ERROR: can't execute cc -q64 -D_LARGE_FILES -D__XCOFF32__ -D__XCOFF64__ -brtl -qstat-o simpserv2 BS-185029c.c simpserv.c  -L${TUXDIR}/lib  -brtl -qstaticinline  -ltux -lbuft   -lfml -l

 

 

 

하지만 소문자 tolower로 서비스를 생성하여 컴파일 해줬을 때는 

에러가 나오지 않았습니다.

 

 

[node1@jwchoi:/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp]# buildserver -o simpserv2 -f simpserv.c -s tolower
BS-1940162.c:
simpserv.c:
ld: 0711-224 WARNING: Duplicate symbol: tpsvrinit
ld: 0711-224 WARNING: Duplicate symbol: .tpsvrinit
ld: 0711-224 WARNING: Duplicate symbol: .userlog
ld: 0711-224 WARNING: Duplicate symbol: userlog
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

 

 

왜 그랬던 걸까요?

 

결과적으로는 TOLOWER가 맞습니다.

 


 

tmadmin -r 로 접속하여 

 

 

프로세서들이 잘 진행되었는지 명령어들로 확인해봤습니다.

 

어? tolower 서비스가 올라와있습니다!

 

그런데 결과적으로는 TOLOWER가 맞다는 것 입니다.

 

그렇다면 tolower는 그냥 빈 껍데기겠죠?

 

저는 이부분에 대해서 차근차근 진행해보면서 답을 알게되었습니다.

 

[node1@jwchoi:/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp]# tmadmin -r
tmadmin - Copyright (c) 1996-2016 Oracle.
All Rights Reserved.
Distributed under license by Oracle.
Tuxedo is a registered trademark.
TMADMIN_CAT:199: WARN: Cannot become administrator.Limited set of commands available.

> psr
Prog Name      Queue Name  2ndQueue Name  Grp Name      ID RqDone Load Done Current Service
---------      ----------  ----------     --------      -- ------ --------- ---------------
WSL            00001.00200                WSLGRP       200      0         0 (  IDLE )
BBL            123457                     simple         0      0         0 (  IDLE )
simpserv       00002.00001                GROUP1         1      0         0 (  IDLE )
simpserv2      00003.00002                GROUP2         2      0         0 (  IDLE )

> psc
Service Name Routine Name Prog Name  Grp Name  ID    Machine  # Done Status
------------ ------------ ---------  --------  --    -------  ------ ------
TOUPPER      TOUPPER      simpserv   GROUP1     1     simple       0 AVAIL
tolower      tolower      simpserv2  GROUP2     2     simple       0 AVAIL

> pclt
     LMID         User Name       Client Name    Time    Status  Bgn/Cmmt/Abrt
--------------- --------------- --------------- -------- ------- -------------
simple          jwchoi          WSH              0:00:15 IDLE    0/0/0
simple          jwchoi          WSH              0:00:15 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:14 IDLE    0/0/0
simple          jwchoi          WSH              0:00:13 IDLE    0/0/0
simple          jwchoi          WSH              0:00:13 IDLE    0/0/0
simple          jwchoi          WSH              0:00:13 IDLE    0/0/0
simple          jwchoi          tmadmin          0:00:04 IDLE    0/0/0

> psr
Prog Name      Queue Name  2ndQueue Name  Grp Name      ID RqDone Load Done Current Service
---------      ----------  ----------     --------      -- ------ --------- ---------------
WSL            00001.00200                WSLGRP       200      0         0 (  IDLE )
BBL            123457                     simple         0      1        50 (  IDLE )
simpserv       00002.00001                GROUP1         1      3       150 (  IDLE )
simpserv2      00003.00002                GROUP2         2      0         0 (  IDLE )

 

 

위에 말씀드렸다시피 또 한가지 문제점은 

 

simpserv.c 는 TOUPPER 서비스를 함수 형태로 가지고 있는 파일이기 때문에

만들어진 실행모듈 simpserv2 로는 TOLOWER 서비스를 호출하지 못할 것 ' 

 

이라는 것 입니다 !

 

 

 

그렇다면 어떻게 해야할까요?

 

 

제가 앞서 만든 실행모듈 simpserv2 는 simpserv.c 파일을 컴파일한 내용들이 들어있습니다.

따라서 TOUPPER 서비스를 가지고 있을 것 입니다.

 

아무리 서비스 호출을 해봤자 안될 것 입니다.

 

해답은 .c 파일을 따로 복사하여 서비스 함수를 바꿔준다음 다시 buildserver로 컴파일을 진행하는 것 입니다.

 

 

말한대로 진행해보겠습니다.

 

simpserv.c 파일을 cp로 복사합니다.

cp simpserv.c simpserv2.c

그리고 vi simpserv2.c 로 들어가 

 

TOUPPER 부분들이 있는 로직들을 모두 tolower 서비스로 바꿔주었습니다. 코드 맨 아래로 내려보시면 됩니다.

 

[node1@jwchoi:/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp]# vi simpserv2.c
"simpserv2.c" 85 lines, 2155 characters 
/*
        Copyright (c) 2011 Oracle, Inc.
        All rights reserved

        THIS IS UNPUBLISHED PROPRIETARY
        SOURCE CODE OF ORACLE, Inc.
        The copyright notice above does not
        evidence any actual or intended
        publication of such source code.
*/


/*      (c) 2003 BEA Systems, Inc. All Rights Reserved. */
/*      Copyright (c) 1997 BEA Systems, Inc.
        All rights reserved

        THIS IS UNPUBLISHED PROPRIETARY
        SOURCE CODE OF BEA Systems, Inc.
        The copyright notice above does not
        evidence any actual or intended
        publication of such source code.
*/

/* #ident       "@(#) samples/atmi/simpapp/simpserv.c   $Revision: 1.7 $" */

#include <stdio.h>
#include <ctype.h>
#include <atmi.h>       /* TUXEDO Header File */
#include <userlog.h>    /* TUXEDO Header File */

/* tpsvrinit is executed when a server is booted, before it begins
   processing requests.  It is not necessary to have this function.
   Also available is tpsvrdone (not used in this example), which is
   called at server shutdown time.
*/

#if defined(__STDC__) || defined(__cplusplus)
tpsvrinit(int argc, char *argv[])
#else
tpsvrinit(argc, argv)
int argc;
char **argv;
#endif
{
        /* Some compilers warn if argc and argv aren't used. */
        argc = argc;
        argv = argv;

        /* simpapp is non-transactional, so there is no need for tpsvrinit()
           to call tx_open() or tpopen().  However, if this code is modified
           to run in a Tuxedo group associated with a Resource Manager then
           either a call to tx_open() or a call to tpopen() must be inserted
           here.
        */
"simpserv2.c" 85 lines, 2155 characters
           either a call to tx_open() or a call to tpopen() must be inserted
           here.
        */

        /* userlog writes to the central TUXEDO message log */
        userlog("Welcome to the simple server");
        return(0);
}

/* This function performs the actual service requested by the client.
   Its argument is a structure containing among other things a pointer
   to the data buffer, and the length of the data buffer.
*/

#ifdef __cplusplus
extern "C"
#endif
void
#if defined(__STDC__) || defined(__cplusplus)
tolower(TPSVCINFO *rqst)
#else
tolower(rqst)
TPSVCINFO *rqst;
#endif
{

        int i;

        for(i = 0; i < rqst->len-1; i++)
                rqst->data[i] = tolower(rqst->data[i]);

        /* Return the transformed buffer to the requestor. */
        tpreturn(TPSUCCESS, 0, rqst->data, 0L, 0);
}

 

 

 

이제 buildserver로 컴파일을 해줄 단계 입니다.

 

buildserver -o 생성할 실행모듈의 이름 -f .c파일 -s 서비스명 

buildserver -o simpserv2 -f simpserv2.c -s tolower

 

그런데 이런 에러가 나옵니다.

[node1@jwchoi:/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp]# serv2 -f simpserv2.c -s tolower
BS-1f0244.c:
simpserv2.c:
"simpserv2.c", line 73.1: 1506-343 (S) Redeclaration of tolower differs from previous declaration on  "/usr/include/ctype.h".
"simpserv2.c", line 73.1: 1506-050 (I) Return type "void" in redeclaration is not compatible with theeturn type "int".
"simpserv2.c", line 73.1: 1506-381 (I) The type "int" of parameter 1 in the prototype declaration is ble with the corresponding parameter type "struct tpsvcinfo*" in the nonprototype declaration.
CMDTUX_CAT:1832: ERROR: can't execute cc -q64 -D_LARGE_FILES -D__XCOFF32__ -D__XCOFF64__ -brtl -qstat-I$TUXDIR/include -o simpserv2 BS-1f0244.c simpserv2.c  -L${TUXDIR}/lib  -brtl -qstaticinline  -ltux fml -lfml32 -lengine -lpthread

 

왜 그런 것인지 모르겠으니 vi 로 진입하여 73번째 라인을 살펴보았으나 아무 문제 없었습니다.

 

제 생각으로는 .c 파일 내에 들어있는 함수 형태로 만들어진 서비스는 "대문자" 이어야 한다는 생각이 들었습니다.

제가 앞에서 만든 서비스명은 아마 껍떼기 이었을 것 입니다.

 

그래서 컴파일 하기 전, 다시 대문자로 바꿔주었습니다. (if문 속의 tolower는 고쳐주실 필요 없습니다. 소문자 tolower 자체가 함수이기 때문 입니다.

 

다음과 같이 설정 후 wq로 저장하였습니다.

   +60
   +61  /* This function performs the actual service requested by the client.
   +62     Its argument is a structure containing among other things a pointer
   +63     to the data buffer, and the length of the data buffer.
   +64  */
   +65
   +66  #ifdef __cplusplus
   +67  extern "C"
   +68  #endif
   +69  void
   +70  #if defined(__STDC__) || defined(__cplusplus)
   +71  TOLOWER(TPSVCINFO *rqst)
   +72  #else
   +73  TOLOWER(rqst)
   +74  TPSVCINFO *rqst;
   +75  #endif
   +76  {
   +77  
   +78          int i;
   +79  
   +80          for(i = 0; i < rqst->len-1; i++)
   +81                  rqst->data[i] = tolower(rqst->data[i]);
   +82  
   +83          /* Return the transformed buffer to the requestor. */
   +84          tpreturn(TPSUCCESS, 0, rqst->data, 0L, 0);
   +85  }

 

그럼 다시 buildserver로 컴파일을 진행해보겠습니다.

서비스명을 대문자로 해줍니다.

 

buildserver -o simpserv2 -f simpserv2.c -s TOLOWER

 

에러가 나지 않고 정상적으로 실행모듈이 생성되었습니다..

 

[node1@jwchoi:/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp]# f simpserv2.c -s TOLOWER <
BS-2ef0102.c:
simpserv2.c:
ld: 0711-224 WARNING: Duplicate symbol: .tpsvrinit
ld: 0711-224 WARNING: Duplicate symbol: .userlog
ld: 0711-224 WARNING: Duplicate symbol: userlog
ld: 0711-224 WARNING: Duplicate symbol: tpsvrinit
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

 

실행모듈을 실행시켜줍니다.


정상적으로 simpserv2 라는  AP server가 실행되었습니다.

[node1@jwchoi:/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp]# tmboot -s simpserv2
INFO: Oracle Tuxedo, Version 12.2.2.0.0, 64-bit, Patch Level (none)

Booting server processes ...

exec simpserv2 -A :
        process id=43516274 ... Started.
1 process started.
[node1@jwchoi:/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp]# tmadmin -r 
tmadmin - Copyright (c) 1996-2016 Oracle.
All Rights Reserved.
Distributed under license by Oracle.
Tuxedo is a registered trademark.
TMADMIN_CAT:199: WARN: Cannot become administrator.Limited set of commands available.

> psr
Prog Name      Queue Name  2ndQueue Name  Grp Name      ID RqDone Load Done Current Service
---------      ----------  ----------     --------      -- ------ --------- ---------------
WSL            00001.00200                WSLGRP       200      0         0 (  IDLE )
BBL            123457                     simple         0      0         0 (  IDLE )
simpserv       00002.00001                GROUP1         1      0         0 (  IDLE )
simpserv2      00003.00002                GROUP2         2      0         0 (  IDLE )

> psc
Service Name Routine Name Prog Name  Grp Name  ID    Machine  # Done Status
------------ ------------ ---------  --------  --    -------  ------ ------
TOUPPER      TOUPPER      simpserv   GROUP1     1     simple       0 AVAIL
TOLOWER      TOLOWER      simpserv2  GROUP2     2     simple       0 AVAIL

 

그렇다면 이제 client가 TOLOWER 서비스를 호출을 할 수 있을 것 입니다.

 

 

 

Client는 무엇을 설정해줘야만 AP서버의 TOLOWER 서비스를 호출할 수 있을까요?

 

정답은

ubbconfig 파일에서 WSL 프로세스의 포트를 지정해준 곳으로, 즉  client는 그 포트를 통해서 tuxedo에 접속하게 됨으로써 서비스를 호출할 수 있을 것 입니다.

 

그러기 위해서 클라이언트는 WSL로 접속하기 위해 WSNADDR 이라는 환경변수를 설정해주게 됩니다.

 

export WSNADDR=//IP:Port 

 

ex) 

export WSNADDR=//211.123.55.111:5555

 

이렇게 설정을 하게 되면 client는 WSL에 접속을 하게 됩니다.

 

이와 동시에 simpcl.c 이라는 클라이언트 설정 파일을 컴파일 해주어야 합니다.

 

이 부분은 buildserver를 했던 과정과 똑같습니다.

 

위에도 말씀드렸다시피 tuxedo를 설치하게 되면 기본적으로 내장되어 함수처리된 서비스인 TOUPPER가 있습니다. 

 

때문에 simpcl.c 파일도 TOUPPER 서비스에 관한 내용이 있기 때문에 이 파일을 그대로 컴파일하여서 TOLOWER 서비스를 불러오고자 한다면 에러가 나오게 됩니다.

 

그러니... 

 

복사를 해주고,

cp simpcl.c simpcl2.c

 

simpcl2.c 를 아래와 같이 vi 편집을 해줘야 합니다.

 

 

 

[node2@jwchoi:/ofm/jwchoi/sw/tp/tuxedo12.2.2.0.0/samples/atmi/simpapp]# vi simpcl2.c   
"simpcl2.c" 81 lines, 1826 characters 
/*      (c) 2003 BEA Systems, Inc. All Rights Reserved. */
/*      Copyright (c) 1997 BEA Systems, Inc.
        All rights reserved

        THIS IS UNPUBLISHED PROPRIETARY
        SOURCE CODE OF BEA Systems, Inc.
        The copyright notice above does not
        evidence any actual or intended
        publication of such source code.
*/

/* #ident       "@(#) samples/atmi/simpapp/simpcl.c     $Revision: 1.5 $" */

#include <stdio.h>
#include "atmi.h"               /* TUXEDO  Header File */


#if defined(__STDC__) || defined(__cplusplus)
main(int argc, char *argv[])
#else
main(argc, argv)
int argc;
char *argv[];
#endif

{

        char *sendbuf, *rcvbuf;
        long sendlen, rcvlen;
        int ret;

        if(argc != 2) {
                (void) fprintf(stderr, "Usage: simpcl string\n");
                exit(1);
        }

        /* Attach to System/T as a Client Process */
        if (tpinit((TPINIT *) NULL) == -1) {
                (void) fprintf(stderr, "Tpinit failed\n");
                exit(1);
        }

        sendlen = strlen(argv[1]);

        /* Allocate STRING buffers for the request and the reply */
"simpcl2.c" 81 lines, 1826 characters

        /* Allocate STRING buffers for the request and the reply */

        if((sendbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
                (void) fprintf(stderr,"Error allocating send buffer\n");
                tpterm();
                exit(1);
        }

        if((rcvbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
                (void) fprintf(stderr,"Error allocating receive buffer\n");
                tpfree(sendbuf);
                tpterm();
                exit(1);
        }

        (void) strcpy(sendbuf, argv[1]);

        /* Request the service TOLOWER, waiting for a reply */
        ret = tpcall("TOLOWER", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);

        if(ret == -1) {
                (void) fprintf(stderr, "Can't send request to service TOLOWER\n");
                (void) fprintf(stderr, "Tperrno = %d\n", tperrno);
                tpfree(sendbuf);
                tpfree(rcvbuf);
                tpterm();
                exit(1);
        }

        (void) fprintf(stdout, "Returned string is: %s\n", rcvbuf);

        /* Free Buffers & Detach from System/T */
        tpfree(sendbuf);
        tpfree(rcvbuf);
        tpterm();
        return(0);
}
~
~
~
~
~
~
~
        return(0);
}
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
        }

        /* Attach to System/T as a Client Process */
        if (tpinit((TPINIT *) NULL) == -1) {
                (void) fprintf(stderr, "Tpinit failed\n");
                exit(1);
        }

        sendlen = strlen(argv[1]);

        /* Allocate STRING buffers for the request and the reply */

        if((sendbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
                (void) fprintf(stderr,"Error allocating send buffer\n");
                tpterm();
                exit(1);
        }

        if((rcvbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
                (void) fprintf(stderr,"Error allocating receive buffer\n");
                tpfree(sendbuf);
                tpterm();
                exit(1);
        }

        (void) strcpy(sendbuf, argv[1]);

        /* Request the service TOLOWER, waiting for a reply */
        ret = tpcall("TOLOWER", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);

        if(ret == -1) {
                (void) fprintf(stderr, "Can't send request to service TOLOWER\n");
                (void) fprintf(stderr, "Tperrno = %d\n", tperrno);
                tpfree(sendbuf);
                tpfree(rcvbuf);
                tpterm();
                exit(1);
        }

        (void) fprintf(stdout, "Returned string is: %s\n", rcvbuf);

        /* Free Buffers & Detach from System/T */
        tpfree(sendbuf);
        tpfree(rcvbuf);
        tpterm();
/*      (c) 2003 BEA Systems, Inc. All Rights Reserved. */
/*      Copyright (c) 1997 BEA Systems, Inc.
        All rights reserved

        THIS IS UNPUBLISHED PROPRIETARY
        SOURCE CODE OF BEA Systems, Inc.
        The copyright notice above does not
        evidence any actual or intended
        publication of such source code.
*/

/* #ident       "@(#) samples/atmi/simpapp/simpcl.c     $Revision: 1.5 $" */

#include <stdio.h>
#include "atmi.h"               /* TUXEDO  Header File */


#if defined(__STDC__) || defined(__cplusplus)
main(int argc, char *argv[])
#else
main(argc, argv)
int argc;
char *argv[];
#endif

{

        char *sendbuf, *rcvbuf;
        long sendlen, rcvlen;
        int ret;

        if(argc != 2) {
                (void) fprintf(stderr, "Usage: simpcl string\n");
                exit(1);
        }

        /* Attach to System/T as a Client Process */
        if (tpinit((TPINIT *) NULL) == -1) {
                (void) fprintf(stderr, "Tpinit failed\n");
                exit(1);
        }

        sendlen = strlen(argv[1]);

        /* Allocate STRING buffers for the request and the reply */

        /* Allocate STRING buffers for the request and the reply */

        if((sendbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
                (void) fprintf(stderr,"Error allocating send buffer\n");
                tpterm();
                exit(1);
        }

        if((rcvbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
                (void) fprintf(stderr,"Error allocating receive buffer\n");
                tpfree(sendbuf);
                tpterm();
                exit(1);
        }

        (void) strcpy(sendbuf, argv[1]);

        /* Request the service TOLOWER, waiting for a reply */
        ret = tpcall("TOLOWER", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);

        if(ret == -1) {
                (void) fprintf(stderr, "Can't send request to service TOLOWER\n");
                (void) fprintf(stderr, "Tperrno = %d\n", tperrno);
                tpfree(sendbuf);
                tpfree(rcvbuf);
                tpterm();
                exit(1);
        }

        (void) fprintf(stdout, "Returned string is: %s\n", rcvbuf);

        /* Free Buffers & Detach from System/T */
        tpfree(sendbuf);
        tpfree(rcvbuf);
        tpterm();
        return(0);
}

 

코드를 잘 읽어가면서 내려가는 습관도 들이면 아주 좋을 것 같습니다. (저에게 하는 말)

 

TOUPPER 부분을 TOLOWER로 바꿔주면 되는 간단한 작업을 마치게 되면 

 

:wq 로 편집기를 나오면 됩니다..

 

 

 

이제 클라이언트파일을 컴파일 해야합니다.

buildclient -w -o simpcl2 -f simpcl2.c

 

 

이 과정을 모두 마치게 되면...

 

서비스를 호출해봅니다.

 

 

./simpcl2 "대문자" 를 실행하게 되면 문자열이 소문자로 리턴되는 것을 확인할 수 있습니다.

 

 

 

 

이상입니다.

 

 

 

궁금하신 점이 있다면 댓글로 남겨주세요!

 

함께 공부하고 싶습니다.

 

 

 

감사합니다.

 

 

 

 

 

 

 

 

 

+ Recent posts