Advertisement
Valtsu

Hajo1

Jan 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1.  
  2. @kovipu
  3.  
  4. 0
  5. 1
  6.  
  7. 0
  8.  
  9. iikjl/Hajo1 Private
  10. Code
  11. Issues 1
  12. Pull requests 0
  13. Projects 0
  14. Wiki
  15. Insights
  16. Hajo1/Task1/x/main.txt
  17. d6d4a1b Nov 16, 2017
  18. @ooavah ooavah minor changes
  19. 46 lines (28 sloc) 983 Bytes
  20.  
  21.  
  22. main:
  23. call Sumservice
  24. Listen to port3127
  25. timeout 5s
  26. receive t from Y
  27. send t port numbers to y via port3127 (for loop?)
  28. create t * Sumthread(tcpPort,id)
  29.  
  30. /** Listen for requests */
  31. timeout 60s
  32. if 1, call sum(threadid), restart timer
  33. if 2, call biggest
  34. if 3, call amount
  35. if value is not [1,2,3,0] send -1 via port3127
  36.  
  37.  
  38.  
  39.  
  40.  
  41. Sumservice:
  42. Send port 3127 to 3126
  43.  
  44.  
  45. sumthread:
  46. listen to port and store received data (add value to existing sum and increment number of members) until zero appears
  47. close connection to Y
  48. Thread.interrupt()
  49.  
  50.  
  51.  
  52.  
  53.  
  54. sum:
  55. ask sum from thread
  56. send sum to Y via port3127
  57.  
  58. biggest:
  59. ask sum from every thread
  60. send largest sum to Y via port3127
  61.  
  62. amount:
  63. ask amount from every threads
  64. sum amounts and send it to Y via port3127
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement