자바 네트워크 프로그래밍 All About Sockets 2 Reading from and Writing to a Socket import java.io.*;import java.net.*; public class EchoClient { public static void main(String[] args) throws IOException { Socket echoSocket = null; PrintWriter out = null;
자바 네트워크 프로그래밍 All About Sockets 1 참조 : http://java.sun.com/docs/books/tutorial/networking/sockets/index.html 앞에서 살펴보았던 URL과 URLConnection 객체를 사용한 프로그래밍은 상당히 높은 추상화 단계에서 접근하는 것입니다. 하지만 만약 클라이언트-서버 프로그래밍을 하게 된다면, 매우 구체적은 단계에서 접근할 필요가 있습니다. 클라이언트-서버 프로그램들은 각자 소켓을 사용하여 서로를 연결하고
자바 네트워크 프로그래밍 Java에서 URL 다루기 2 Connecting to a URL URL 객체를 생성한 다음 openConnection 메소드를 사용하여 URLConnection 객체를 생성할 수 있습니다. 다음은 Yahoo.com URL의 Connection 객체를 만드는 예제 코드입니다. try { URL yahoo = new URL(“http://www.yahoo.com/”); URLConnection yahooConnection = yahoo.