Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. if (inputValues[0].equalsIgnoreCase("RETR")) {
  2. if(!inputValues[0].equalsIgnoreCase("LIST") && inputValues.length == 1 ) {
  3.  
  4. if(inputValues[0].equalsIgnoreCase("RETR") && inputValues.length == 1 )
  5. output.writeUTF("");
  6.  
  7.  
  8. continue; }
  9. output.writeUTF(rIMSG);// to server
  10. // output.flush();//clears the line
  11. if(getInput.readUTF().equalsIgnoreCase("true")) {//listen from server
  12. try {
  13.  
  14.  
  15.  
  16. ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
  17.  
  18. byte[] buffer = (byte[]) ois.readObject();
  19. System.out.println("#"+buffer.length);
  20. String sent = k.nextLine();
  21. if(sent.equalsIgnoreCase("send")) {
  22.  
  23. FileOutputStream fos = new FileOutputStream(inputValues[1]);
  24. fos.write(buffer);
  25. fos.flush();
  26. System.out.print("This is a small file, the file is sent without a terminating null.");
  27.  
  28.  
  29. }
  30. else {
  31. System.out.print("+ok, RETR aborted");
  32. rIMSG="";
  33. }
  34. } catch (ClassNotFoundException xd) {
  35.  
  36. }
  37. }
  38. else {
  39. System.out.println("-File not found.");
  40. check = 1;
  41.  
  42. }
  43. continue;
  44. }
  45.  
  46. if (!inputValues[0].equals("RETR"))
  47. output.writeUTF(rIMSG);
  48.  
  49. } catch (IOException e) {
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement