home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Java / Java.zip / nrs100.zip / Submit.nrx < prev   
Text File  |  1999-06-29  |  1KB  |  46 lines

  1. -- Submit.nrx 1.0
  2. --
  3. --
  4.   class Submit
  5.  
  6.     method main(args=String[]) public static
  7.  
  8.       arg=rexx(args)
  9.  
  10.       parse arg filename
  11.  
  12.       if filename = '' then exit
  13.  
  14.       server= 'localhost'
  15.       port  = 8080
  16.  
  17.       do
  18.         say 'Connecting to NRServer at address "'server'" on port "'port'"'
  19.         clientSocket = Socket(server, port)
  20.  
  21.         -- output to server over socket
  22.         out = PrintWriter(OutputStreamWriter(clientSocket.getOutputStream()))
  23.  
  24.         -- input from server over socket
  25.         in  = BufferedReader(InputStreamReader(clientSocket.getInputStream()))
  26.  
  27.         -- send filename to server and flush the socket
  28.         out.printLn(filename)
  29.         out.flush()
  30.  
  31.         -- Read response from server
  32.         line=String(in.readline())
  33.  
  34.         loop while line \= null
  35.           say line
  36.           line = in.readline()
  37.           end -- loop while
  38.  
  39.           catch e=IOException
  40.             say 'IOException (' e ') caught:\n' e.getMessage()
  41.  
  42.         end -- while line
  43.  
  44.       exit 0
  45.  
  46.