home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1998 September / dppcpro0998.iso / Rwc / Sybase / Install.exe / samples.z / Form_Server$Connection.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-03-25  |  1.7 KB  |  57 lines

  1. import java.io.DataInputStream;
  2. import java.io.IOException;
  3. import java.io.PrintStream;
  4. import java.net.Socket;
  5. import powersoft.powerj.util.Debug;
  6.  
  7. class Form_Server$Connection extends Thread {
  8.    // $FF: synthetic field
  9.    final Form_Server this$Form_Server;
  10.    DataInputStream input;
  11.    PrintStream output;
  12.    Socket localClientSocket;
  13.  
  14.    public Form_Server$Connection(Form_Server var1, Socket var2) {
  15.       this.this$Form_Server = var1;
  16.       this.localClientSocket = var2;
  17.  
  18.       try {
  19.          this.input = new DataInputStream(this.localClientSocket.getInputStream());
  20.          this.output = new PrintStream(this.localClientSocket.getOutputStream());
  21.       } catch (IOException var3) {
  22.          Debug.log("IOException while creating socket IO streams!");
  23.          return;
  24.       }
  25.  
  26.       ((Thread)this).start();
  27.    }
  28.  
  29.    public void run() {
  30.       try {
  31.          while(true) {
  32.             String var1 = this.input.readLine();
  33.             if (var1 != null) {
  34.                String var2 = "Message received: \"" + var1 + "\"";
  35.                this.this$Form_Server.lb_1.add(var2);
  36.                var2 = var2 + " Thank you";
  37.                this.output.println(var2);
  38.                continue;
  39.             }
  40.          }
  41.       } catch (IOException var11) {
  42.          Form_Server var10000 = this.this$Form_Server;
  43.          Debug.log("IOException while listening for input!");
  44.       } finally {
  45.          try {
  46.             this.localClientSocket.close();
  47.             this.this$Form_Server.lb_1.add("Connection terminated. Bye!");
  48.          } catch (IOException var10) {
  49.             Form_Server var14 = this.this$Form_Server;
  50.             Debug.log("IOException while closing client socket on server!");
  51.          }
  52.  
  53.       }
  54.  
  55.    }
  56. }
  57.