      SUBROUTINE PLW.POST.LISTEN(L.TP,ADDR,PORT,RESULT)
*PIC-LAN
*
*ALL
*PC
*N
*
*
*
*
      INCLUDE SYS.TYPE.INCLUDE
*
      INCLUDE PL.COMMON
      INCLUDE PL.COMMON.DEFS
      INCLUDE PL.DEFS
      INCLUDE PLIP.COMMON
      INCLUDE PLW.COMMON
*
      RESULT = ''
*
      PL_CONFIG ELSE
         RESULT = 'Error getting CONFIG.'
         RETURN
      END
*
      P.NO.START = PL_CONFIG_P.NO.START()
      NO.PORTS   = PL_CONFIG_NO.PORTS()
      P.NO.END   = P.NO.START + NO.PORTS - 1
*
      FOR P.NO = P.NO.START TO P.NO.END
         PL_PLCB.STATUS P.NO THEN
            TP = PL_PLCB.STATUS_TP()
            IF TP = TP.TCP THEN
               IF PL_TCP.STATUS_STATE() = 15 THEN
                  IF PL_TCP.STATUS_LIP() = ADDR THEN
                     IF PL_TCP.STATUS_LPORT() = ADDR THEN
                        RESULT = 'Listen is already posted.'
                        RETURN
                     END
                  END
               END
            END
         END
      NEXT P.NO
*
      BEGIN CASE
         CASE L.TP = 'WEB'
            PL_TCP_POST_MUL_LISTEN_WEB ADDR , PORT , PORT.NO ELSE
               RESULT = 'Error posting listen. [1]'
               RETURN
            END
            PL_TCP_SET_EVENTS RES,EVENT.ACTIVITY,MSG.TIMEOUT,PLIP$WWW.TIMEOUT,0,0,0
*$*         PL_TCP_SET_TIMEOUT RES , ( 10 * 60 )
         CASE L.TP = 'UNL'
            PL_TCP_POST_MUL_LISTEN_UNL ADDR , PORT , PORT.NO ELSE
               RESULT = 'Error posting listen. [2]'
               RETURN
            END
            PL_TCP_SET_EVENTS RES,EVENT.ACTIVITY,MSG.LONG.TIMEOUT,(60*60),0,0,0
         CASE YES
            PL_TCP_POST_MUL_LISTEN ADDR , PORT , PORT.NO ELSE
               RESULT = 'Error posting listen. [3]'
               RETURN
            END
            PL_TCP_SET_EVENTS RES,EVENT.ACTIVITY,MSG.LONG.TIMEOUT,(60*60),0,0,0
*$*         PL_TCP_SET_TIMEOUT RES , ( 20 * 60 )
      END CASE
*
      RETURN
   END
