ServerSocket ss = null; Socket soc = null; OutputStream out = null; InputStream in = null;
try{ ss = new ServerSocket(22344); System.out.println("서버 래디 .....");
}catch(IOException ee){} try{ soc = ss.accept(); System.out.println("접근자 => " + soc.toString()); out = soc.getOutputStream(); //클라이언트와 이야기 가능 in = soc.getInputStream(); //클라이언트로부터 이야기를 들을수잇다. }catch(IOException ee){}
}
}
클라
more..
package Net;
import java.io.*; import java.net.*;
public class Ex02_11 { public static void main(String[] args) {
InetAddress ia = null; Socket soc = null; OutputStream out = null; InputStream in = null; try{ ia = InetAddress.getByName("220.81.20.109");
}catch(UnknownHostException ee){} try{ soc = new Socket(ia, 22344);//노크하기.. out = soc.getOutputStream();//서버에게 이야기 in = soc.getInputStream();//서버로부터 이야기듣기