try { Client = new Socket(args[0],600); InputS = new DataInputStream(Client.getInputStream()); OutputS = new PrintStream(Client.getOutputStream()); KeyS = new DataInputStream(System.in); } catch(IOException e) { System.out.println("Cannot Connect with Server"); return; }
try { while (i<5) { data = KeyS.readLine(); OutputS.println(data); System.out.println("ECHO From Server:"+ InputS.readLine()); i++; } } catch(IOException e) { System.out.println("IOException Happened"); }
try { System.out.println("Now will end this program"); Client.close(); } catch(IOException e) { System.out.println("system cannot close socket"); } } }
//@@@@@@@@@@@@@@@@@@@@@@@222
class LudCanvas extends Canvas { public void paint(Graphics g) { Rectangle r = getBounds(); g.setColor(Color.red); int panelHeight = 15; int b = 3; g.drawRect(b , b , r.width-b-b , r.height-b-b-panelHeight); int t = 10; g.drawRect(t , t , r.width-t-t , r.height-t-t-panelHeight);
g.drawString("The first applet of mine", 120, 30);