연결하는 클라이언트 서버를 실행할 때 파일을 보내려고하면 오류를 가져 오는 전체 파일을 보내지 않습니다. 끊임없이 같은 부분에서 멈 춥니 다. 동일한 시스템에 서버 - 클라이언트를 실행하는 경우클라이언트 - 서버가 전체 파일을 보내지 않음
// input (a DataInputstream) is set up elsewhere and messages are sent and received properly
String FILE_TO_RECEIVED = "Load_From.xml";
File file = new File(FILE_TO_RECEIVED);
int FILE_SIZE = input.readInt();
if(FILE_SIZE!=0){
// receive file
System.out.println("received file size : " + FILE_SIZE);
byte [] mybytearray = new byte [FILE_SIZE];
FileOutputStream fos = new FileOutputStream(file);
BufferedOutputStream bos = new BufferedOutputStream(fos);
int bytesRead = input.read(mybytearray, 0, mybytearray.length);
bos.write(mybytearray, 0, bytesRead);
어디서 멈 춥니 까? 작은 파일 (예 : 2KB)에서도 작동합니까? –