FileDocCategorySizeDatePackage
SocketServer.javaAPI DocExample702Thu Dec 24 16:06:24 GMT 1998tuning.server

SocketServer

public class SocketServer extends Object implements Runnable

Fields Summary
static ServerSocket
sock
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    try
    {
    sock = new ServerSocket(12345);
    (new Thread(new SocketServer())).start();
    (new Thread(new SocketServer())).start();
    }
    catch (Exception e)    { System.out.println(e);}

  
public voidrun()

  for (;;)
  {
    try
    {
      Socket client = sock.accept();
      Thread.sleep(10000);
      client.close();
	System.out.println("Closed from " + Thread.currentThread());
    }
    catch (Exception e)    { System.out.println(e);}
  }