      SUBROUTINE PLU.GET.PORT(TP,PORT)
*PIC-LAN
*
*ALL
*PC
*N
*
*
*
*
******************************************************************************
******************************************************************************
***                                                                        ***
*** (C) Copyright 1990-2005 Doug Dumitru, All Rights Reserved.             ***
***                                                                        ***
*** This program is licensed under the terms of the GNU General Public     ***
*** License, version 2.0 with attached notices.                            ***
***                                                                        ***
*** The full text can be found in the LICENSE.TXT file in the              ***
*** PLIP.BP database file (the /usr/qmweb/PLIP.BP/PLIP.BP directory).      ***
***                                                                        ***
******************************************************************************
******************************************************************************
*
      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
