Advertisement
YauhenMardan

Untitled

Sep 30th, 2020
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. // TODO: 9/24/20 Rewrite if/else if to map
  2.  
  3. // @Override
  4. // public void run() {
  5. // log.info(clientAddress + ": CONNECTION ESTABLISHED");
  6. // try {
  7. // byte[] bytes_s;
  8. // String command;
  9. // String[] commandSplit;
  10. // //Get public key
  11. // receivePublicKey();
  12. // //Send symmetric key
  13. // sendSessionKey();
  14. //
  15. // while (true) {
  16. // bytes_s = readBytes();
  17. // command = new String(bytes_s);
  18. // commandSplit = command.split(" ");
  19. //
  20. // if (commandSplit[0].equals(endMessage)) {
  21. // log.info(clientAddress + ": CONNECTION ABORTED");
  22. // stopClient();
  23. // break;
  24. // } else if (commandSplit[0].equals(requestMessage)) {
  25. // byte[] bytes;
  26. // String fileName = commandSplit[1];
  27. // log.info(clientAddress + ": GOT REQUEST FOR FILE " + fileName);
  28. // try {
  29. // bytes = readBytesFromFile(fileName);
  30. // log.info(clientAddress + ": SENDING ACCEPT MESSAGE... " + fileName);
  31. // writeBytes(acceptMessage.getBytes());
  32. // log.info(clientAddress + ": SENDING FILE... " + fileName);
  33. // writeBytes(bytes);
  34. // log.info(clientAddress + ": FILE SENT " + fileName);
  35. // } catch (IOException exception) {
  36. // log.info(clientAddress + ": SENDING DENY MESSAGE... " + fileName);
  37. // writeBytes(denyMessage.getBytes());
  38. // log.info(clientAddress + ": FILE IS NOT FOUND " + fileName);
  39. // }
  40. //
  41. // } else if (commandSplit[0].equals(echoMessage)) {
  42. // String message = commandSplit[1];
  43. // log.info(clientAddress + ": GOT ECHO MESSAGE ");
  44. // writeBytes(message.getBytes());
  45. // log.info(clientAddress + ": SENT ECHO MESSAGE BACK");
  46. // } else if (commandSplit[0].equals(saveMessage)) {
  47. // byte[] bytes;
  48. // String fileName = commandSplit[1];
  49. // log.info(clientAddress + ": GOT REQUEST FOR FILE SAVING " + fileName);
  50. // try {
  51. // log.info(clientAddress + ": SENDING ACCEPT MESSAGE... " + fileName);
  52. // writeBytes(acceptMessage.getBytes());
  53. // bytes = readBytes();
  54. // writeBytesToFile(bytes, fileName);
  55. // } catch (IOException exception) {
  56. // log.info(clientAddress + ": SENDING DENY MESSAGE... " + fileName);
  57. // }
  58. //
  59. // } else if (commandSplit[0].equals(generateMessage)) {
  60. // log.info(clientAddress + ": GET GENERATE MESSAGE");
  61. // serpentScrambler = null;
  62. // sendSessionKey();
  63. // } else {
  64. // log.info(clientAddress + ": INVALID COMMAND");
  65. // }
  66. // }
  67. // } catch (
  68. // Exception exception) {
  69. // log.warning(exception.getMessage());
  70. // }
  71. //
  72. // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement