      SUBROUTINE PLU.GET.PORT(TP,PORT)
*PIC-LAN
*
*ALL
*PC
*N
*
*
*
*
      INCLUDE SYS.TYPE.INCLUDE
*
      INCLUDE PL.COMMON
      INCLUDE PL.COMMON.DEFS
      INCLUDE PL.DEFS
      INCLUDE PLIP.COMMON
*
      OPEN 'PLIP.CTRL' TO CTRL.FD ELSE CALL PLXX.STOP(201,'PLIP.CTRL')
*
      PL_LOCK 25
*
      BEGIN CASE
         CASE TP = 'UDP'
            PL_READU PORT FROM CTRL.FD , 'UDP.PORT' ELSE PORT = 2000
            IF PORT < 2000 OR PORT > 3998 THEN PORT = 2000
            WRITE ( PORT + 1 ) ON CTRL.FD , 'UDP.PORT'
         CASE TP = 'TCP'
            PL_READU PORT FROM CTRL.FD , 'TCP.PORT' ELSE PORT = 2000
            IF PORT < 2000 OR PORT > 3998 THEN PORT = 2000
            WRITE ( PORT + 1 ) ON CTRL.FD , 'TCP.PORT'
         CASE YES
            PRINT 'Invalid call to PLU.GET.PORT.'
            STOP
      END CASE
*
      PL_UNLOCK 25
*
      RETURN
   END
