Á¦ ¼Ò½ºÀÔ´Ï´Ù.


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :ÀÚ¹Ù¸Ç 2000³â 3¿ù 07ÀÏ 14:42:13

In Reply to: ¼ÒÄϽÿ¡´Â º¸Åë... Reader, Writer... posted by ¹Ú¼º±¸ on 2000³â 3¿ù 07ÀÏ 10:08:52:

Á¦ ¼Ò½ºÀÔ´Ï´Ù.
Ȥ½Ã µµ¿òÀÌ µÉ·±Áö..
´Ü¼øÈ÷ ¼­¹ö¿¡ °¬´Ù ¿À´Â °Ì´Ï´Ù..
Thread¸¦ ÀÌ¿ëÇؼ­ °è¼Ó ¿Ô´Ù °¬´Ù ÇÏ°Ô °íÃÄ º¸¼¼¿ä..
±×¸®°í °íÄ£ ¼Ò½º¸¦ ¿Ã·Á ÁÖ¼¼¿ä..Àúµµ ÇÊ¿äÇϴϱî¿ä..
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.net.*;


public class Ec extends Applet {
Socket socket;
TextField textfield;
TextArea textarea;
PrintWriter out;
BufferedReader in;
int PORT = 12348;


public void init(){
setLayout(new BorderLayout());
textfield = new TextField(16);
textarea = new TextArea();
add("South",textarea);
add("North",textfield);
ClientSocket();
}


public void ClientSocket(){
try{
socket = new Socket(getCodeBase().getHost(),PORT,true);
// if true, the socket transmit a stream.
out = new PrintWriter(socket.getOutputStream(),true);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
}catch(UnknownHostException e) {
}catch(IOException e){ } // end of try statement..
}


public boolean action(Event e, Object o){
if(e.target == textfield){
out.println((String)e.arg);
out.flush();
try{
textfield.setText(""); // clear after input integer..
textarea.setText(in.readLine());
repaint();
}catch(IOException ee){} // end try
try{
out.close();
in.close();
socket.close();
}catch(IOException ee){} // end try
return true;
} // end if
return false;
} // end action
}






´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
HTML ÅÂ±× Æ÷ÇÔ ¿©ºÎ: HTML ¹®¼­ÀÏ °æ¿ì üũ
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]