receive
-
Java - Network - File I/OJava 2018. 2. 7. 10:46
// Network를 통한 File I/O는// Socket을 통해서 주고 받는다 import java.io.BufferedInputStream;import java.io.DataOutputStream;import java.io.File;import java.io.FileInputStream;import java.net.Socket; public class SenderMain { public static void main(String[] args) throws Exception { // 1. 경로 지정 String path = "D:/io/bang.gif"; File file = new File(path); // 2. 스트림 준비 FileInputStream fis = new FileInputStream..
-
Java - Network, MultiChatJava 2018. 2. 6. 10:29
import java.io.IOException;import java.net.Socket; public class MultiClient { public static void main(String[] args) throws IOException { Socket socket = null; // 1. 소켓 생성 + 2. 연결 요청 try { socket = new Socket("127.0.0.1", 9000); // 3. 할일 하기 + 스레드 생성 및 실행 System.out.println("연결 수락"); ClientSender sender = new ClientSender(socket); ClientReceiver receiver = new ClientReceiver(socket); sender.start..