336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; public class client { public static void main(String[] args) { BufferedReader user = new BufferedReader(new InputStreamReader( System.in)); Socket socket; try { socket = new Socket("115.20.247.142", 1251); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); ReceiveThread rt = new ReceiveThread(socket); rt.start(); while (true) { out.println(user.readLine()); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } class ReceiveThread extends Thread { Socket socket; public ReceiveThread(Socket socket) { this.socket = socket; } @Override public void run() { BufferedReader in; try { in = new BufferedReader(new InputStreamReader( socket.getInputStream())); while (true) { System.out.println(in.readLine()); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } super.run(); } }
'Programming > JAVA,JSP' 카테고리의 다른 글
JAVA JTable 실습 예제 (0) | 2013.08.24 |
---|---|
JAVA 채팅 프로그램 소스 (0) | 2013.08.23 |
JAVA 계산기 프로그램 부분완성 (0) | 2013.08.16 |
JAVA 계산기 레이아웃 (0) | 2013.08.16 |
JAVA 타자연습 프로그램 (0) | 2013.08.13 |