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

  1. import java.io.IOException;
  2. import java.net.ServerSocket;
  3. import java.net.Socket;
  4. import powersoft.powerj.util.Debug;
  5.  
  6. public class Form_Server$Server extends Thread {
  7.    // $FF: synthetic field
  8.    final Form_Server this$Form_Server;
  9.    ServerSocket listeningSocket;
  10.  
  11.    public Form_Server$Server(Form_Server var1, int var2) {
  12.       this.this$Form_Server = var1;
  13.       if (var2 < 0) {
  14.          var2 = 1777;
  15.       }
  16.  
  17.       try {
  18.          this.listeningSocket = new ServerSocket(var2);
  19.       } catch (IOException var4) {
  20.          Debug.log("IOException while creating ServerSocket");
  21.          System.exit(1);
  22.       }
  23.  
  24.       String var3 = "Server is listening on port " + var2;
  25.       var1.lb_1.add(var3);
  26.       ((Thread)this).start();
  27.    }
  28.  
  29.    public void run() {
  30.       try {
  31.          while(true) {
  32.             Socket var1 = this.listeningSocket.accept();
  33.             this.this$Form_Server.lb_1.add("Client socket successfully created on server.");
  34.             new Form_Server$Connection(this.this$Form_Server, var1);
  35.             String var3 = "Connected to " + var1.getInetAddress().getHostName();
  36.             this.this$Form_Server.lb_1.add(var3);
  37.          }
  38.       } catch (IOException var4) {
  39.          Form_Server var10000 = this.this$Form_Server;
  40.          Debug.log("IOException while listening for connection requests!");
  41.       }
  42.    }
  43. }
  44.