× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Ian,

here is a program I use - it waits for the connection messages on msgq 
QTCP.

I modified it from someone elses post from the list - this one will time 
out and retry, if there are problems.  for the customer I use this for, 
every now and then the peers would shake hands, then go into a never 
ending loop without ever completing the connetion, with the only recourse 
being to endtcpptp and start over.  so I just put that code in this 
procedure.

the sndusrmsgs are only temporary until I'm comfortable that it works 
every time.

hth,

rick

/*********************************************************************/  
/*                                                                   */  
/*     PROGRAM : MONPTPCL                                            */  
/*     FUNCTION: start ptp connection and monitor for connect msg    */  
/*     AUTHOR  : Rick Baird                                          */  
/*                                                                   */  
/*********************************************************************/  
  
             PGM        PARM(&CFGPRF &ERROR)  
  
             DCL        VAR(&CFGPRF)  TYPE(*CHAR) LEN(10)  
             DCL        VAR(&MSGID)   TYPE(*CHAR) LEN(7)  
             DCL        VAR(&HLDMSG)  TYPE(*CHAR) LEN(7)  
             DCL        VAR(&ERROR)   TYPE(*CHAR) LEN(15)  
             DCL        VAR(&COUNT)   TYPE(*DEC)  LEN(2 0) VALUE(0)  
             DCL        VAR(&COUNT1)  TYPE(*DEC)  LEN(2 0) VALUE(0)  
  
  
/* try to alloc msgq - if it fails, wait and try 50 times again */  
  
 ALLOC:      ALCOBJ     OBJ((QTCP *MSGQ *EXCL)) WAIT(0)  
             MONMSG     MSGID(CPF1002) EXEC(DO)  
               CHGVAR     VAR(&COUNT) VALUE(&COUNT + 1)  
  
/* couldn't allocate message queue.  error message          */  
  
               IF         COND(&COUNT > 70) THEN(DO)  
                 SNDPGMMSG  MSGID(CPF9897) MSGF(QCPFMSG) +  
                          MSGDTA('MONPTPCL (' *CAT &CFGPRF *TCAT +  
                          ') was unsuccessful.  The QTCP +  
                          message queue could +  
                          not be allocated.') TOUSR(*SYSOPR)  
                 ENDTCPPTP  CFGPRF(&CFGPRF)  
                 CHGVAR     VAR(&COUNT1) VALUE(&COUNT1 + 1)  
  
                 IF         COND(&COUNT1 > 90) THEN(DO)  
                     CHGVAR     VAR(&ERROR) VALUE('ERROR')  
                     SNDUSRMSG  MSG('Allocate of QTCP MsgQ timed out - +  
                          MONPTPCL error #2 -' || &CFGPRF) +  
                          MSGTYPE(*INFO) TOUSR(BAIRDR)  
                     GOTO CMDLBL(ENDPGM)  
                 ENDDO  
  
                 SNDUSRMSG  MSG('Can''t allocate QTCP MsgQ - trying +  
                          again - MONPTPCL error #1 -' || &CFGPRF) +  
                          MSGTYPE(*INFO) TOUSR(BAIRDR)  
                 DLYJOB     DLY(10)  
                 GOTO       CMDLBL(ALLOC)  
               ENDDO  
  
               GOTO       CMDLBL(ALLOC)  
             ENDDO  
  
             DLCOBJ     OBJ((QTCP *MSGQ *EXCL))  
  
/* do priming reads on msgq, to clear any lingering messages*/  
  
 READMSGQ1:  CHGVAR     VAR(&MSGID) VALUE(' ')  
  
             RCVMSG     MSGQ(QTCP) WAIT(3) RMV(*NO) MSGID(&MSGID)  
  
             IF         COND(&MSGID *NE '       ') THEN(DO)  
               GOTO    CMDLBL(READMSGQ1)  
             ENDDO  
  
/* start p2p connection                   */  
  
             STRTCPPTP  CFGPRF(&CFGPRF)  
             CHGVAR     VAR(&COUNT) VALUE(0)  
  
/* loop until msg TCP8344 (tcp started) is revieced       */  
  
 READMSGQ2:  CHGVAR     VAR(&MSGID) VALUE(' ')  
  
             RCVMSG     MSGQ(QTCP) WAIT(5) RMV(*NO) MSGID(&MSGID)  
  
             IF         COND(&MSGID *NE '       ') THEN(CHGVAR +  
                          VAR(&HLDMSG) VALUE(&MSGID))  
  
/* found the connect message, no error, ready to go      */  
  
             IF         COND(&MSGID *EQ 'TCP8344') THEN(DO)  
                CHGVAR     VAR(&ERROR) VALUE('        ')  
                GOTO    CMDLBL(ENDPGM)  
             ENDDO  
  
/* found the connection ended message - cancel.          */  
  
             IF         COND(&MSGID *EQ 'TCP837F' +  
                         *OR &MSGID *EQ 'TCP8242' +  
                         *OR &MSGID *EQ 'TCP8209' +  
                         *OR &MSGID *EQ 'TCP836B') THEN(DO)  
               SNDPGMMSG  MSGID(CPF9897) MSGF(QCPFMSG) +  
                          MSGDTA('MONPTPCL (' *CAT &CFGPRF *TCAT ') +  
                          was unsuccessful. STRTCPPTP command ended +  
                          due to a system error. See MSGID ' +  
                          *CAT &HLDMSG) TOUSR(*SYSOPR)  
               CHGVAR     VAR(&ERROR) VALUE('ERROR' *BCAT &MSGID)  
               ENDTCPPTP  CFGPRF(&CFGPRF)  
               SNDUSRMSG  MSG('System Error MsgId:' || &HLDMSG || ' - +  
                          Trying again - MONPTPCL error #3 -' || +  
                          &CFGPRF) MSGTYPE(*INFO) TOUSR(BAIRDR)  
               DLYJOB     DLY(10)  
               GOTO       CMDLBL(ALLOC)  
             ENDDO  
  
/*  wait for connection message 80 times, then fail.       */  
  
             CHGVAR     VAR(&COUNT) VALUE(&COUNT + 1)  
  
             IF         COND(&COUNT *GT 80) THEN(DO)  
               SNDPGMMSG  MSGID(CPF9897) MSGF(QCPFMSG) +  
                          MSGDTA('MONPTPCL (' *CAT &CFGPRF *TCAT ') +  
                          was unsuccessful. STRTCPPTP command timed +  
                          out before recieving the connect +  
                          message-' *CAT &HLDMSG *CAT ' trying +  
                          again') TOUSR(*SYSOPR)  
               CHGVAR     VAR(&ERROR) VALUE('ERROR TIMEOUT')  
               ENDTCPPTP  CFGPRF(&CFGPRF)  
               SNDUSRMSG  MSG('STRTCPPTP timed out - trying again - +  
                          MONPTPCL error #4 -' || &CFGPRF) +  
                          MSGTYPE(*INFO) TOUSR(BAIRDR)  
               DLYJOB     DLY(10)  
               GOTO       CMDLBL(ALLOC)  
             ENDDO  
  
             GOTO       CMDLBL(READMSGQ2)  
  
/* connection has been established               */  
  
 ENDPGM:     ENDPGM  
  



-----original message---------
I start a tcp ptp session using the command STRTCPPTP <name>
This does not return info if the session start is successful or not 
because
it then submits other jobs.
Does anyone know of an API or other method to start a PTP session and
determine programmatically that the session start has been successful ?

Thanks

Regards

Ian Patterson

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.