@@ -198,7 +198,6 @@ private void processHeader(Socket clientSocket, String header) throws ServerRunT
198
198
199
199
this .totalFileSize = Long .parseLong (headerInfo .nextLine ());
200
200
generalFileName = headerInfo .nextLine ();
201
- System .out .println (header );
202
201
203
202
this .notifyAddToTransferenceObservers (generalFileName , src_addr );
204
203
while (headerInfo .hasNextLine ()){
@@ -239,7 +238,6 @@ else if(fileInfo.charAt(0) == 'F'){ //File
239
238
240
239
private void receiveFile (Socket clientSocket , String filePath , Long fileSize ) throws ServerRunTimeException {
241
240
try {
242
- System .out .println (filePath + " " + fileSize );
243
241
filePath .replace ("\\ " , "\\ \\ " );
244
242
this .output = new DataOutputStream (new BufferedOutputStream (new FileOutputStream (new File (filePath ))));
245
243
@@ -257,18 +255,18 @@ private void receiveFile(Socket clientSocket, String filePath, Long fileSize) th
257
255
while (integerFileSizeValue > 0 && (bytesReaded = this .input .read (this .buffer , 0 , Math .min (this .BUFFERSIZE , integerFileSizeValue ))) >= 0 ){
258
256
this .output .write (this .buffer , 0 , bytesReaded );
259
257
this .output .flush ();
260
- //System.out.println(bytesReaded);
261
258
fileSize -= bytesReaded ;
262
259
263
260
totalBytesReaded += bytesReaded ;
264
261
if (integerMaxValueExceeded && fileSize < Integer .MAX_VALUE ){
265
262
integerFileSizeValue = Math .toIntExact (fileSize );
266
263
integerMaxValueExceeded = false ;
267
264
}
268
- System .out .println (filePath + " " +integerFileSizeValue );
265
+ else if (!integerMaxValueExceeded ){
266
+ integerFileSizeValue -= bytesReaded ;
267
+ }
269
268
this .notifyUpdateToTransferenceObservers (this .getProgress (totalBytesReaded ), clientSocket .getInetAddress ().toString ().substring (1 ));
270
269
}
271
- //System.out.println(bytesReaded);
272
270
}
273
271
catch (FileNotFoundException e ){
274
272
this .notifyRemoveToTransferenceObservers (clientSocket .getInetAddress ().toString ().substring (1 ));
@@ -333,7 +331,6 @@ private void notifyRemoveToTransferenceObservers(String src_addr){
333
331
}
334
332
335
333
private void notifyException (String message ){
336
- System .out .println ("entro por aquí" );
337
334
for (TransferencesObserver observer : this .transferenceObserversList ){
338
335
observer .notifyException (message );
339
336
}
0 commit comments