PROCEDURE rap$define_rexecs (
  protocol, p: key (stream_socket, ss), (cdna_session, cs), keyend = stream_socket
  status)

*IF $variable(rav$proc_doc,declared)<>'UNKNOWN'

"    This request defines the REXEC server.
"
*IFEND

  VAR
    command_file: file = $unique($local)
    ignore_status: status
    local_status: status
  VAREND

  IF protocol = stream_socket THEN
    collect_text command_file until='    collect_end' sm='?'
      $system.osf$command_library.manage_network_applications
        define_tcpip_application application=osa$rexec_server protocol=?protocol?
          change_maximum_sockets maximum_sockets=200
        quit
        activate_tcpip_application application=osa$rexec_server
      quit
    collect_end
  ELSE
    put_line 'WARNING - TCP/IP Gateway support terminated at release level 1.7.1' o=$response
    collect_text command_file until='    collect_end' sm='?'
      $system.osf$command_library.manage_network_applications
        define_client client=osa$rexec_server protocol=?protocol?
          change_maximum_connections maximum_connections=200
        quit
        activate_client client=osa$rexec_server
      quit
    collect_end
  IFEND

  include_file command_file status=local_status
  delete_file command_file status=ignore_status

  IF local_status.normal THEN
    put_line ' REXEC server is defined' o=$response
  IFEND

  EXIT_PROC WITH local_status WHEN NOT local_status.normal

PROCEND rap$define_rexecs

