//raul anso, elari moks, ojar kristal import java.applet.Applet; import java.net.*; import java.io.*; import java.awt.*; import java.awt.event.*; public class fingerjaserv extends Frame implements ActionListener{ TextField kasutaja=new TextField("kasutaja"); TextField server=new TextField("server"); TextArea vastus=new TextArea(9,55); Button ok=new Button(" OK "); public fingerjaserv(){ setLayout(new FlowLayout()); add(kasutaja); add(server); add(ok); add(vastus); kasutaja.addActionListener(this); server.addActionListener(this); ok.addActionListener(this); setSize(450, 250); setBackground(Color.black); setVisible(true); } public void actionPerformed (ActionEvent e){ try{ Socket sc=new Socket(server.getText(), 79); BufferedReader sisse=new BufferedReader( new InputStreamReader (sc.getInputStream()) ); PrintWriter valja=new PrintWriter(sc.getOutputStream(),true); valja.println(kasutaja.getText()); String rida=sisse.readLine(); String tulemus=""; while(rida!=null){ tulemus=tulemus+"\n"+rida; vastus.setText(tulemus); rida=sisse.readLine(); } } catch(Exception viga){} } public static void main(String argumendid[]){ new fingerjaserv(); } }