Advertisement
Guest User

Untitled

a guest
Nov 10th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.75 KB | None | 0 0
  1. //Alexander Maksimov
  2. package robot;
  3.  
  4. import java.awt.event.ActionEvent;
  5. import java.awt.event.ActionListener;
  6. import java.awt.image.BufferedImage;
  7. import java.net.*;
  8. import java.io.*;
  9. import javax.swing.Timer;
  10. import java.util.ArrayList;
  11. import java.util.Random;
  12. import java.util.logging.Level;
  13. import java.util.logging.Logger;
  14. import javax.imageio.ImageIO;
  15.  
  16. class ClientListener implements Runnable {
  17.  
  18. Socket c;
  19.  
  20. public ClientListener(Socket c) {
  21. this.c = c;
  22. }
  23. String userName;
  24. String password;
  25. String info;
  26. String len;
  27. String foto;
  28. String FILE = "foto0.png";
  29. Integer fotoLen = 0;
  30. String ks;
  31.  
  32. @Override
  33. public void run() {
  34.  
  35. DataInputStream inFromClient;
  36. try {
  37.  
  38. inFromClient = new DataInputStream(c.getInputStream());
  39. DataOutputStream outToClient = new DataOutputStream(c.getOutputStream());
  40. outToClient.writeBytes("200 LOGIN\r\n");
  41.  
  42.  
  43. // Timer t = new Timer(45, new ActionListener() {
  44. // @Override
  45. // public void actionPerformed(ActionEvent e) {
  46. // DataOutputStream outToClient;
  47. // try {
  48. // outToClient = new DataOutputStream(c.getOutputStream());
  49. // outToClient.writeBytes("502 TIMEOUT\r\n");
  50. // c.close();
  51. // } catch (IOException ex) {
  52. // Logger.getLogger(ClientListener.class.getName()).log(Level.SEVERE, null, ex);
  53. // }
  54. //
  55. // }
  56. // });
  57.  
  58.  
  59.  
  60.  
  61. String writeDown = "";
  62. while (!writeDown.endsWith("\r\n")) {
  63. byte cc = inFromClient.readByte();
  64. writeDown += new String(new byte[]{cc}, "US-ASCII");
  65. }
  66. this.userName = writeDown.substring(0, writeDown.length() - 2);
  67. System.out.println("Received: " + c.getRemoteSocketAddress().toString() + ":" + writeDown);
  68.  
  69. outToClient.writeBytes("201 PASSWORD\r\n");
  70.  
  71. writeDown = "";
  72. while (!writeDown.endsWith("\r\n")) {
  73. byte cc = inFromClient.readByte();
  74. writeDown += new String(new byte[]{cc}, "US-ASCII");
  75. }
  76. this.password = writeDown.substring(0, writeDown.length() - 2);
  77. System.out.println("Received: " + c.getRemoteSocketAddress().toString() + ":" + writeDown);
  78.  
  79. if (!this.userName.startsWith("Robot")) {
  80. outToClient.writeBytes("500 LOGIN FAILED\r\n");
  81. c.close();
  82. return;
  83. }
  84.  
  85. Integer passwordAsItMustBe = 0;
  86. byte[] unb = this.userName.getBytes("US-ASCII");
  87. for (byte b : unb) {
  88. passwordAsItMustBe += b;
  89. }
  90. if (!this.password.equals(passwordAsItMustBe.toString())) {
  91. outToClient.writeBytes("500 LOGIN FAILED\r\n");
  92. c.close();
  93. return;
  94. }
  95. outToClient.writeBytes("202 OK\r\n");
  96.  
  97. while (true) {
  98.  
  99.  
  100. writeDown = "";
  101.  
  102. for (int j = 0; j < 5; j++) {
  103. byte cc = inFromClient.readByte();
  104. writeDown += new String(new byte[]{cc}, "US-ASCII");
  105. }
  106.  
  107. if (!"INFO ".equals(writeDown) || !"FOTO ".equals(writeDown)) {
  108. outToClient.writeBytes("501 SYNTAX ERROR\r\n");
  109. c.close();
  110. return;
  111. }
  112.  
  113. if ("INFO ".equals(writeDown)) {
  114. while (!writeDown.endsWith("\r\n")) {
  115. byte cc = inFromClient.readByte();
  116. writeDown += new String(new byte[]{cc}, "US-ASCII");
  117. }
  118. this.info = writeDown.substring(0, writeDown.length() - 2);
  119. System.out.println("Received: " + c.getRemoteSocketAddress().toString() + ":" + writeDown);
  120. outToClient.writeBytes("202 OK\r\n");
  121. }
  122.  
  123. File fnew = new File("foto0.png");
  124. BufferedImage originalImage = ImageIO.read(fnew);
  125. ByteArrayOutputStream baos = new ByteArrayOutputStream();
  126. ImageIO.write(originalImage, "png", baos);
  127. if ("FOTO ".equals(writeDown)) {
  128. while (!writeDown.endsWith(" ")) {
  129.  
  130. byte cc = inFromClient.readByte();
  131. writeDown += new String(new byte[]{cc}, "US-ASCII");
  132. len += new String(new byte[]{cc}, "US-ASCII");
  133.  
  134. }
  135. int intLen = Integer.parseInt(len);
  136.  
  137. boolean one = true;
  138.  
  139. String m = "";
  140. while (one) {
  141. byte cc = inFromClient.readByte();
  142. writeDown += new String(new byte[]{cc}, "US-ASCII");
  143. m += new String(new byte[]{cc}, "US-ASCII");
  144. one = false;
  145. }
  146. if (!" ".equals(m)) {
  147. outToClient.writeBytes("501 SYNTAX ERROR\r\n");
  148. c.close();
  149. return;
  150. }
  151.  
  152. for (int i = 0; i < intLen; i++) {
  153. byte[] b = new byte[1];
  154. foto = "";
  155. byte cc = inFromClient.readByte();
  156. writeDown += new String(new byte[]{cc}, "US-ASCII");
  157. foto += new String(new byte[]{cc}, "US-ASCII");
  158. fotoLen += Integer.parseInt(foto);
  159. b = baos.toByteArray();
  160. }
  161.  
  162. byte[] bytes = new byte[4];
  163. for (int i = 0; i < 4; i++) {
  164. byte cc = inFromClient.readByte();
  165. writeDown += new String(new byte[]{cc}, "US-ASCII");
  166. bytes[i] = cc;
  167. //ks += new String(new byte[]{cc}, "US-ASCII");
  168. }
  169. int value = 0;
  170. for (int i = 0; i <= 3; i++) {
  171. value = (value << 8) + (bytes[i] & 0xFF);
  172. }
  173.  
  174. if (fotoLen != value) {
  175. outToClient.writeBytes("300 BAD CHECKSUM\r\n");
  176. fnew.delete();
  177.  
  178. return;
  179. }
  180. if (fotoLen == value) {
  181. outToClient.writeBytes("202 OK\r\n");
  182. ArrayList ar = new ArrayList();
  183. Random rn = new Random();
  184. int r = rn.nextInt(999) + 1;
  185.  
  186. while (!ar.contains(r)) {
  187. r++;
  188. if (r > 999) {
  189. r = 1;
  190. }
  191.  
  192. }
  193. ar.add(r);
  194. File f = new File("foto" + r + ".png");
  195. fnew.renameTo(f);
  196. //c.close();
  197. }
  198.  
  199. }
  200.  
  201. }
  202.  
  203. //c.close();
  204. } catch (IOException ex) {
  205. System.err.println("Couldn't get I/O.");
  206. System.exit(1);
  207.  
  208. }
  209.  
  210. }
  211.  
  212. }
  213.  
  214. class Server {
  215.  
  216. public static void svr_main(int port) throws IOException {
  217. ServerSocket serverSocket = null;
  218. try {
  219. serverSocket = new ServerSocket(port);
  220. } catch (IOException e) {
  221. System.err.println("Could not listen on port: " + port);
  222. System.exit(1);
  223. }
  224. Socket clientSocket = null;
  225. while (true) {
  226. try {
  227. clientSocket = serverSocket.accept();
  228. } catch (IOException e) {
  229. serverSocket.close();
  230. System.err.println("Accept failed.");
  231. System.exit(1);
  232. }
  233. System.out.println("client accepted from: " + clientSocket.getInetAddress()
  234. + ":" + clientSocket.getPort());
  235. ClientListener cl = new ClientListener(clientSocket);
  236. Thread thread = new Thread(cl);
  237. thread.start();
  238. }
  239. }
  240. }
  241.  
  242. public class Robot {
  243.  
  244. public static void main(String[] args) throws IOException {
  245. if (args.length == 0) {
  246. System.err.println("Server: java robot.Robot <port>");
  247. System.exit(1);
  248. }
  249. System.out.println("Starting server...\n");
  250. Server server = new Server();
  251. server.svr_main(Integer.parseInt(args[0]));
  252. }
  253. }
  254.  
  255.  
  256.  
  257.  
  258. === RESULTS ===
  259.  
  260. TEST 1: error 103
  261. TEST 2: error 103
  262. TEST 3: error 3
  263. TEST 4: ok
  264. TEST 5: ok
  265. TEST 6: error 2
  266. TEST 7: error 2
  267. TEST 8: error 2
  268. TEST 9: error 2
  269. TEST 10: error 103
  270. TEST 11: error 106
  271. TEST 12: ok
  272. TEST 13: error 2
  273. TEST 14: ok
  274. TEST 15: ok
  275.  
  276. === TEST 1 ===
  277. [49] RX (11 bytes): '200 LOGIN\r\n'
  278. [49] TX (15 bytes): 'Robot345\r\n674\r\n'
  279. [50] RX (1 bytes): '2'
  280. [50] RX (1 bytes): '0'
  281. [50] RX (1 bytes): '1'
  282. [50] RX (1 bytes): ' '
  283. [50] RX (1 bytes): 'P'
  284. [50] RX (1 bytes): 'A'
  285. [50] RX (1 bytes): 'S'
  286. [50] RX (1 bytes): 'S'
  287. [50] RX (1 bytes): 'W'
  288. [50] RX (1 bytes): 'O'
  289. [50] RX (1 bytes): 'R'
  290. [50] RX (1 bytes): 'D'
  291. [50] RX (1 bytes): '\r'
  292. [50] RX (1 bytes): '\n'
  293. [62] RX (1 bytes): '2'
  294. [62] RX (1 bytes): '0'
  295. [62] RX (1 bytes): '2'
  296. [63] RX (1 bytes): ' '
  297. [63] RX (1 bytes): 'O'
  298. [63] RX (1 bytes): 'K'
  299. [63] RX (1 bytes): '\r'
  300. [63] RX (1 bytes): '\n'
  301. [63] TX (45 bytes): 'INFO 2014-02-19 03:34 nefunkcni c... (truncated)'
  302. [63] RX (1 bytes): '5'
  303. [63] close()
  304. [63] result=103
  305.  
  306. === TEST 2 ===
  307. [49] RX (11 bytes): '200 LOGIN\r\n'
  308. [49] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
  309. [51] RX (1 bytes): '2'
  310. [51] RX (1 bytes): '0'
  311. [51] RX (1 bytes): '1'
  312. [51] RX (1 bytes): ' '
  313. [51] RX (1 bytes): 'P'
  314. [51] RX (1 bytes): 'A'
  315. [51] RX (1 bytes): 'S'
  316. [51] RX (1 bytes): 'S'
  317. [51] RX (1 bytes): 'W'
  318. [51] RX (1 bytes): 'O'
  319. [51] RX (1 bytes): 'R'
  320. [51] RX (1 bytes): 'D'
  321. [51] RX (1 bytes): '\r'
  322. [51] RX (1 bytes): '\n'
  323. [51] RX (1 bytes): '2'
  324. [51] RX (1 bytes): '0'
  325. [51] RX (1 bytes): '2'
  326. [51] RX (1 bytes): ' '
  327. [51] RX (1 bytes): 'O'
  328. [51] RX (1 bytes): 'K'
  329. [51] RX (1 bytes): '\r'
  330. [51] RX (1 bytes): '\n'
  331. [51] TX (22 bytes): 'INFO \r \n\r \n \r\nINFO \r\nX'
  332. [51] RX (1 bytes): '5'
  333. [51] close()
  334. [51] result=103
  335.  
  336. === TEST 3 ===
  337. [49] RX (11 bytes): '200 LOGIN\r\n'
  338. [49] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
  339. [62] RX (5 bytes): '201 P'
  340. [65] RX (17 bytes): 'ASSWORD\r\n202 OK\r\n'
  341. [65] TX (2 bytes): '\r\n'
  342. [389] close()
  343. [389] result=3
  344.  
  345. === TEST 4 ===
  346. [49] RX (11 bytes): '200 LOGIN\r\n'
  347. [49] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
  348. [62] RX (32 bytes): '201 PASSWORD\r\n500 LOGIN FAILED\r\n'
  349. [62] TX (8 bytes): 'INFO X\r\n'
  350. [62] close()
  351. [62] result=0
  352.  
  353. === TEST 5 ===
  354. [49] RX (11 bytes): '200 LOGIN\r\n'
  355. [49] TX (2 bytes): '\r\n'
  356. [52] RX (2 bytes): '20'
  357. [52] RX (2 bytes): '1 '
  358. [62] RX (1 bytes): 'P'
  359. [62] RX (9 bytes): 'ASSWORD\r\n'
  360. [62] TX (2 bytes): '\r\n'
  361. [62] RX (18 bytes): '500 LOGIN FAILED\r\n'
  362. [62] TX (8 bytes): 'INFO X\r\n'
  363. [62] close()
  364. [62] result=0
  365.  
  366. === TEST 6 ===
  367. [49] RX (11 bytes): '200 LOGIN\r\n'
  368. [49] TX (8192 bytes): 'Robot \xc7\xde\x0c,\x84&dq\x87\xfe\x13\x9f\x11|\x95a"\x1dGy\x05\x16Z\xdfi$\x8d... (truncated)'
  369. [49] TX (8192 bytes): '\xae\xaa\x9a$,\x1e$\xb1G\xa4\xdfL"\xad\x8e\x9axf5\x0e\xff\x8c3Yf\x9ap\xee\xbc\xe1\xeaj\x8b... (truncated)'
  370. [49] TX (8192 bytes): 'mW\xc3_\xf4\xab\xa4G\xaas\xbcb\xabW\xab@\xea\x13\xd7\xaa\xa5 $\xd6\x98q\xe0y\xc3]\xc90\xb4... (truncated)'
  371. [49] TX (8192 bytes): '\xa2\xfc\x10\x1b\x06 _\x7f2BK\xd1n4\x06\xc8U\xf2l#\xa74\n-\x05\x8ce\x18\x11%\xe3\xb3!... (truncated)'
  372. [49] TX (8192 bytes): '#,\xfa\xe8\x8b\xe8\x0b\xa5CD\xee%\xb3R\xae\xf6\xe5\x99\x9c\xe4\xba\xbeH\xacD\xca\x09\x17C\xf5\xf2g!... (truncated)'
  373. [49] TX (8192 bytes): '?$d\x82\x9e\x93\xfe\x9d\xf2\xb1+\x1aK'%\xc6@)\xa2=\x9c\xf3X_,\xc5n\xfd\xd64\xde\x16X... (truncated)'
  374. [49] TX (8192 bytes): '\x1f^_)4\r\xf0\xc4P\xb4\xa4.\xb23\x01\x90\xa2F\xb9\x03.A\xf3\xe9\x02\xdb=c\\xf7-{V... (truncated)'
  375. [49] TX (8192 bytes): '\xdb\xa7r\x9a\xb3J\xa3OjM"\xfd\_\xcf\xf9\xa0\x02E\xbd\x9f\xb6\xa3\xfe\xc8#\xa4\x94v\x87{Q.... (truncated)'
  376. [49] TX (8192 bytes): ')\xe1L\xde\xab#\xe4\x1a;\xf9\xbbA\xd2\xea\xc7j%\xff\x1f\x19\xfb\x92\xd6(\x9e\xf3n\xb8\xe9\x08\xd4\x13\xe9... (truncated)'
  377. [49] TX (8192 bytes): '_\xa7\xab\xc2\xf5rM\xf9\xe4\x12\xe7\xfdR#RQqNRl\xdf\xbe]\x15\xec\x88\x86\xbc\x89\xefZ\xc7\x96... (truncated)'
  378. [49] TX (8192 bytes): '\xec\xbf#\xd8\xf4N\xd2E@\xc9\xe0\xe6\xae6N\x05\xf2c,"p\xea\x10a\xf6\xc4qI\xe3Ma\xd0\x0c... (truncated)'
  379. [49] TX (8192 bytes): 'v\xf4\x8d\xbcP\x9cv\xb4\x8ex\x02u\xf5\xbbU: \x0ex\xbbT\x01\xbc\xa4\xa4\xa7$\xd4\x0ce\xd7\x83Y... (truncated)'
  380. [49] TX (8192 bytes): 'i\x0c\x8f\xe3\xd6*5U\x8d\x11\xb58\xf4*%\xad\xae\x91o\x8e\xaf\xf3_\x15\x1b\xa4\x15N\xed\xd0\x8dV\xdc... (truncated)'
  381. [49] TX (8192 bytes): '\x94\xebUD]d\x8f\xcf\xcd\x1f\x96\xff\xa0\x04h_\x9f\x01\x90\xaf\xc3\xcbeu)|\x10^\xb1\xa8tE\x93... (truncated)'
  382. [49] Waiting for receiver
  383. [62] TX (8192 bytes): '\x13\x012\\x14q\x9f;_\x00\x83\xd2\x94\xb9*\xb0\x0fr\x8a\x88d4\xe9\xec\x10J\xe3\x05-\x96\xffA\x98... (truncated)'
  384. [62] TX (8192 bytes): '\x9b\xc6+W\xa3=\x81\xd6\xe4\xf6\xf3\xc6\x0c)\xed\xe6,Q\xaa\x90\x9f \xcf\xce\xf8\x19]%\xa6a\x11A'... (truncated)'
  385. [62] TX (8192 bytes): '\xe1\x85W9a\xa8\xce\x16n\x05\x88\x92\xa2\xc9%\x94H\x8b\xcc\xbb\xc6,\xc6\x0b\x81 \xf6\xdb{\x12\x17\\x98... (truncated)'
  386. [62] TX (8192 bytes): '~\x001{\xe4\xf1,\x11s\xbc)\xb2\x12Z\xdc\xbf\xf3\x82\x13|,\x00\xfdH3\xda\x16\xb5\xd4Q\x11RQ... (truncated)'
  387. [62] TX (8192 bytes): '\x86\x1a\x16\xd4\x8f\xf4w3\x14\xc5\xe7\x04\x1aM\xb6G\xaf\xfe\xa3&\xd7\xb1I\xea\xc5\x05\xaa\x0e\xe1\x16\xd5h0... (truncated)'
  388. [62] TX (8192 bytes): '"c\xd6\xf1ry_\xf70mR\xc7\xc4\xb6e\xda\xf6\xd5F@'\xccn\xb9\xfe\x07\xdc\xbb;\xf1\x1c]T... (truncated)'
  389. [62] TX (8192 bytes): '\x14\xbad\xebK\x1d]^C\xdb"\x8bQF\xcfj\x8aN\xbb\xd3\xd3\xc3 \x8b\x05\xa5\x82\x01\xc4\xb7\\xd9r... (truncated)'
  390. [62] TX (8192 bytes): '\xf4\xc6\x0b\x91\x04\xc9\xfeu\x97\xcf\xdar\xeb\x04T\x14J\r\x1b\xdf+\x0e\x87\xd2;\x02l\xbf\xb5\xce\xfc\xa9\x94... (truncated)'
  391. [62] TX (8192 bytes): 'Ki\x95I\xaa\xea\x8d\xa6\x80\x13\xb0\xa7\xf50\xbeA\xd0\x1e\xd7\xe9XD\x1b\xba\x01\xd6\xf7LR\xec\x1f\x9dU... (truncated)'
  392. [62] TX (8192 bytes): '`1=Z\xd3Ekp-\xb0\xc5\x1a\xdfk\xb7\x94}\x02:\x85\xf3\xb2\xfdMO$vL@SG\xa0\x84... (truncated)'
  393. [62] TX (8192 bytes): '\x14~\xd6\x10V*\xe3\x8fe\xdfl\x8cq\xea{\xce\x82\xfcK=\x9a\xe0xN\xf6\xbd|\xc1GK\x0c[\xc9... (truncated)'
  394. [62] TX (8192 bytes): '\x8c\x8f@\xe48\xd11\xe9\xa4\x8e\x06\x0fv\x06]\xa3\xa2\xa2\x1d\x001\x19\xf2\xe9\xc2\xf1\x9e\x81R\xceN\xdf]... (truncated)'
  395. [62] TX (8192 bytes): '#\xc6\x07\xd4#hOZ\xa3\xa5\x86\x98O\xe6\x98\xd4\xdc^kcrx\xc2\xceC\xb7g\x1b~\x1a\xf4\xa1\xe1... (truncated)'
  396. [62] TX (8192 bytes): '\x05\xb3\x14\xef\xf1\x84\x17RQ\x11_D*\x09m\xc1;x\xdb\x07H\xdd\x93\xd9\x10:\x1a\x18\x02\x9f\xd1\x07R... (truncated)'
  397. [62] TX (8192 bytes): '\x86\xed$,?\x0fj\xcf\xf4`\x03\xd5\x9aV\x8d\xc7\xef\x0e\xeed\xab\xea\x8a\x1eX\x8f0\xb3\x90\x8e\xbb\x17{... (truncated)'
  398. [62] TX (8192 bytes): '\xbb\xa7q\xb7\xdf\x19e\xf1'\xfa^p\xfb\xcd\x87\x1fB\xf4\x9b;\x1c\xca\x9f.\x12\xfc,\xaa\x1d&\xdd\xd8\xcd... (truncated)'
  399. [62] Waiting for receiver
  400. [93] TX (8192 bytes): 'M\xb3\xae\xdf)Q\xa0\xcb\xa0\x09\xfa\xd8\x12K\xeaO=SE\x0b\xab\x95@\xa8\x8cmZ\xd0\x13\xf5\xcaa\xa8... (truncated)'
  401. [93] TX (8192 bytes): '\xa7\xfe\x98\xba\xba\x12\xf1\xa6\xc6\xb8\xb9E\r\xaa\x1aw\x9b\xd8MR\xb9\n\xc1\xd2Q)\xd2q\xf9\x84\x84\xa1\x82... (truncated)'
  402. [93] Waiting for receiver
  403. [137] TX (8192 bytes): '\x1d\x152_y\xb8\xdd\x0c\xa8f`\xd0\xc0\x17\x05\x00&\x0c\x87'\x95\x91\x95{A\xbaPf9\x8d\xfdV\xa2... (truncated)'
  404. [137] TX (8192 bytes): '\x8d\xb9r`\x8c\xa8\x9f\r\xba\xa4W\xae_\xff\x88$\xbb\x1a\x8fn\x15\xcf8(qYS\xc4\xe5\xd7\xbbr\x91... (truncated)'
  405. [137] Waiting for receiver
  406. [389] recv() = -1
  407. [389] close()
  408. [389] result=2
  409.  
  410. === TEST 7 ===
  411. [49] RX (11 bytes): '200 LOGIN\r\n'
  412. [49] TX (5 bytes): '\x00\x00\x00\x00\x00'
  413. [250] TX (2 bytes): '\x00\r'
  414. [389] recv() = -1
  415. [389] close()
  416. [389] result=2
  417.  
  418. === TEST 8 ===
  419. [49] RX (11 bytes): '200 LOGIN\r\n'
  420. [49] TX (10 bytes): 'Robot\x00\x00\x00\x00\x00'
  421. [250] TX (2 bytes): '\x00\r'
  422. [389] recv() = -1
  423. [389] close()
  424. [389] result=2
  425.  
  426. === TEST 9 ===
  427. [49] RX (11 bytes): '200 LOGIN\r\n'
  428. [49] TX (8192 bytes): 'Robot \xa8V_E\xfe\xda\x8d\x17\xcc\xcb_\xbb\xe8\xfe\x06VM\x9a\x88\xaa7\xbe\xf1\xd8'5\x8c... (truncated)'
  429. [49] TX (8192 bytes): ')\xeb^\r\x8a\r\x8c\xa5n6\x14\x1c\x1b\x05\xc8\xb5\xe9\xca\xd0\xb4\x89B\x13K\xccl\xdf[i\xd6\xec\x92\xc1... (truncated)'
  430. [49] TX (8192 bytes): '\xe1\xfc\xac\x98,\xd9\xc4j\xcf1\x14U)\xd6W9r\xd2E8\xdb\xe6;S\xdf\x8e,h\xcd\x1a"\xae\x16... (truncated)'
  431. [49] TX (8192 bytes): '^\xb9kX\x1c{F/\xf6\xefx\xd6\xe6\x0f\xf9\xf94\x86\x88\xaa\x8ej\xf1\x9e\xf0r\x18,\xe3\xf6\xaeA\xaf... (truncated)'
  432. [50] TX (8192 bytes): 'I\xb2^@:\xf3\x88\xd3\x01\xab\xa9;;\x13T\x8e\x02w\xabd\xff\xbe$\xed\xba\xb5\xa1\xccV\xdf\xad\x9f\x91... (truncated)'
  433. [50] TX (8192 bytes): '\xc5_\xf6\xe5'\xab\xa2r\xaf\xe2;\x12\xc4/L\x89\x0b\x80\xc1c\x05y\xa7\x99.$Y\xfd\x96Q=[\x8f... (truncated)'
  434. [50] TX (8192 bytes): '\x1e|\xfa\xc9\xa4i\x83 \xe8\xb5\x82H-\x0cZ\xd6+\xd0\x9d\xd8{\x09\xe4\xb6\xd3'db\x11H\x92/\xc5... (truncated)'
  435. [50] TX (8192 bytes): '\xa6-\xc9\x9a\xc9\x8ba\xc1p\xc1Ozg\xb0\x94\xa0\xfa\x98\xb9\xc0\xe8\xe03B\xe6\x13\xee\x9f\xf5\xc3\xd4\x9c\xf0... (truncated)'
  436. [50] TX (8192 bytes): ',\xfdM\xcc\xfaH{\xed\xc9\xc0\x97w\xc3\xe2\x89\xbdA\xb1\xeaPU4z6\xf5\xe4\xa6gn\xc5&\x9b\xc2... (truncated)'
  437. [50] TX (8192 bytes): '\x15m)\xa3N\xf5\xcf\x05\x9a\xf5\x05#_\x04AN\x8d:\xfa2#\xdd\x13\x96\xe5\xf0\xd2-\x13\x93a(\x01... (truncated)'
  438. [50] TX (8192 bytes): '\x0b\xde\rV\x7f\xa3V#\r:8q\x86\x83l5\xbe\xb5\x02\xbc\x8e~C\xfd\x1a\x9f\xd4\xdb\xf7\x90u\x03n... (truncated)'
  439. [50] TX (8192 bytes): '\xbdK\x04'\x19\xf9\xd4\x90\xee\xca/\xb1Rv'\xe1\xdb\x0c\xab\x04"s\xc2\xcd\x94\xe9If\xd9P\xdb\x96\x9b... (truncated)'
  440. [50] TX (8192 bytes): '\xd8\x9e\xfe.\x887\x80\x02\x93\xfbR\x86\xc5\x94\xdb\xb0\xb3\xb8\xfbn1^\xef\xaf\xdaC\x1e\x8e\x85\xd6\xb2]t... (truncated)'
  441. [50] TX (8192 bytes): '\x07\xfbhX\xf0%\xbe\x8d{hV\x85_E?\x00\xe3\xb6\x8e&\x94(c_`8\xf3\xe3\xb0Z\x91\xb7V... (truncated)'
  442. [50] Waiting for receiver
  443. [62] TX (8192 bytes): 'g\x1dcn\x91Kt_\xe0\xe4e\xd5\x8f\xe8\xba\xfe+\xd6_\xa1\xf4\x9a\\xc5\xc9\x84\x15\x80\xdf\xb9bG\xd6... (truncated)'
  444. [62] TX (8192 bytes): '\xc3\xf4+\x90\xfa\xf9_\x8fOV#\x89\xf1+\xcdd\x1f\x83\xdd\xa3\xfa|\x8d0\xa1\xd0\r\x8a\x9f\xdamb\xce... (truncated)'
  445. [62] TX (8192 bytes): 'Q\x18\xeb\xe36\x0b\xae\xcej'\xcd\xcd;\x8d\xe3\x16\x8cX\xd8\xe6\xac\x97\xd5`\x9a!\xe2\xec\xe9 \xa4:9... (truncated)'
  446. [62] TX (8192 bytes): '\x82P\xf0:1\x8fp/\xf6\x8fH\xbd\x16\xcb\x13\x8a|V\x9d}\xbb\x99\xa8ez\xee\xda\xa0\xdb%Q]u... (truncated)'
  447. [62] TX (8192 bytes): '\\x9b\x1c\xee\xfd\xdbk\r\x09\xc2\xb7:`E\xbe\x1e)"?V\x0c\x9d"\xfb\x93\xbb\x16\xcd\x91\x04\xd8\xed\x9f... (truncated)'
  448. [62] TX (8192 bytes): 'Ce\x10\xcb\x90\xe4-SK\xc8\xa0\xf7\x1d\x02c\x80Q\xc2Z\x0eX\x92n\xba\x86_\xaeE/4\xces\x99... (truncated)'
  449. [62] TX (8192 bytes): 'R\xbfpUx\xa4\xc9\xaa\xa6\xc6\xcd3y\xf5G\xa3I\xd2=\xab\xcc\x8d}\x9e\x13\x87\x9a\xaf\x8aRa\xdc\x11... (truncated)'
  450. [62] TX (8192 bytes): '\xf4x=PHJ#\x9f\xa8\x86\xc9(\xd4\x012\xb3\xfb\x0e\xbe\xf3D8F\xcc+'\xdcc\xd0\xcdl\xc5F... (truncated)'
  451. [62] TX (8192 bytes): '\x1e\xaf\xd8n\xab\xb7\x0c\x04\xef\x1fk\xff\xce\xca,\x06x:\xf4\xd5\x87V%\xea2\x14t\x9c\xc0\xe7\xec\xde\x97... (truncated)'
  452. [62] TX (8192 bytes): '\xca/\x1d\x93c\xdd\xbc\xef1\xb7\xb1\x8ec\xb53Z\x85\x16\xfe\x07\xe5as\xb5\x9c\xbdX\xe8\x9f\x0e\x96i=... (truncated)'
  453. [62] TX (8192 bytes): '\xcf\xb6~\xe0\xe4\xdcN\x8e4\xdc\x91\x81\x9c\xf5\x94\xeb%A\xe8N\x857\xeb\xb63\x8d\x1f1_\xc4\x92.{... (truncated)'
  454. [62] TX (8192 bytes): ';v~\x0fw\x80\xcc\xbb\x04\xbc\xc8\xe8\xd8z\x81\x04\xb2w\x01\xde,\xd6\xbc7\xbc\rE"\xe4\xdd\xd5\x1fS... (truncated)'
  455. [62] TX (8192 bytes): '-+Ib\xf8:\xb6\xcb\x04\xe4\xb3H9\xaa\xea)F\xdd\xe6Z!\xc7\xec0y\xbc\xcd|Q\x9d\x05~\xc8... (truncated)'
  456. [62] TX (8192 bytes): '\G\x12\xa7\xd4T{\xf9K\x87\xc4cYs\xab{\xfa_~X\xb3k\xb5_e\xe7\n\x94\x15\x99+q\xe0... (truncated)'
  457. [62] TX (8192 bytes): '\xd3\x05a\x1c$\xf6(R\x07\xb5\xe7g\xbf\xc9qF\x02`W\x0c\xc7\x89\xbf\xf3\x8f\xd2.u\xb0\xf0@\x83\xf5... (truncated)'
  458. [62] TX (8192 bytes): '(\x05/4\xadD\x8f\x8aZ\x86\xf5((\xd5\x1e\xb1\x99\x192a\x1c[J{\x01\x06^\xa2J\x04Dr\x09... (truncated)'
  459. [62] Waiting for receiver
  460. [93] TX (8192 bytes): '\x11\xbb\x1a\xdeiOZN~uj\xad\xd2\xa9WP\\xd8n\x02\xc1Q\xed_\xfc\xdfp\x12y{\x8a\x8a6... (truncated)'
  461. [93] TX (8192 bytes): '\xfc\xdd\x8bO\x91\x10p\xbcf\x9b\xc6$\xe8Y\xedm\xf0\n'\x1fMpe#\xa7\xb7\x18\x1f\x87't\x83\x04... (truncated)'
  462. [93] Waiting for receiver
  463. [137] TX (8192 bytes): '\xcev\x10\xc9\xb1r\x18\xd5"\x87d\xc5\rVQ;\x81;\x17$\xd0\xee.\x1c/\xfc\x12)\xa4oJr\xe5... (truncated)'
  464. [137] TX (8192 bytes): '!\xe2\xe0\xb6\x7fQ\xe3Qx\x00\x97\xd5hB\x8e\xba\xe85V1\xf4O\x89O\x89Nw\xd7\xb4\xc6\x19\xd5\xa9... (truncated)'
  465. [137] Waiting for receiver
  466. [389] recv() = -1
  467. [389] close()
  468. [389] result=2
  469.  
  470. === TEST 10 ===
  471. [50] RX (11 bytes): '200 LOGIN\r\n'
  472. [50] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
  473. [62] RX (5 bytes): '201 P'
  474. [65] RX (17 bytes): 'ASSWORD\r\n202 OK\r\n'
  475. [65] TX (1038 bytes): 'FOTO 1024 \xae\xa8\x81N\x00\x00\x00\x00\r\n_'\x00\x00\x00\x00\x88\xcd\x93!\x00\x00\x00... (truncated)'
  476. [65] RX (1 bytes): '5'
  477. [65] close()
  478. [65] result=103
  479.  
  480. === TEST 11 ===
  481. [50] RX (11 bytes): '200 LOGIN\r\n'
  482. [50] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
  483. [62] RX (5 bytes): '201 P'
  484. [62] RX (17 bytes): 'ASSWORD\r\n202 OK\r\n'
  485. [62] TX (1038 bytes): 'FOTO 1024 \r\n\x99p\x00\x00\x00\x00\xd9\xda*v\x00\x00\x00\x00\xc7\xc9Q\x04\x00\x00\x00... (truncated)'
  486. [62] RX (1 bytes): '5'
  487. [62] close()
  488. [62] result=106
  489.  
  490. === TEST 12 ===
  491. [50] RX (11 bytes): '200 LOGIN\r\n'
  492. [50] TX (118 bytes): 'Robot4769727517262937291679982042... (truncated)'
  493. [64] RX (1 bytes): '2'
  494. [64] RX (1 bytes): '0'
  495. [64] RX (1 bytes): '1'
  496. [64] RX (1 bytes): ' '
  497. [64] RX (1 bytes): 'P'
  498. [64] RX (1 bytes): 'A'
  499. [64] RX (1 bytes): 'S'
  500. [64] RX (1 bytes): 'S'
  501. [64] RX (1 bytes): 'W'
  502. [64] RX (1 bytes): 'O'
  503. [64] RX (1 bytes): 'R'
  504. [64] RX (1 bytes): 'D'
  505. [64] RX (1 bytes): '\r'
  506. [64] RX (1 bytes): '\n'
  507. [64] RX (1 bytes): '2'
  508. [64] RX (1 bytes): '0'
  509. [64] RX (1 bytes): '2'
  510. [64] RX (1 bytes): ' '
  511. [64] RX (1 bytes): 'O'
  512. [65] RX (1 bytes): 'K'
  513. [65] RX (1 bytes): '\r'
  514. [65] RX (1 bytes): '\n'
  515. [65] RX (1 bytes): '5'
  516. [65] RX (1 bytes): '0'
  517. [65] RX (1 bytes): '1'
  518. [65] RX (1 bytes): ' '
  519. [65] RX (1 bytes): 'S'
  520. [65] RX (1 bytes): 'Y'
  521. [65] RX (1 bytes): 'N'
  522. [65] RX (1 bytes): 'T'
  523. [65] RX (1 bytes): 'A'
  524. [65] RX (1 bytes): 'X'
  525. [65] RX (1 bytes): ' '
  526. [65] RX (1 bytes): 'E'
  527. [65] RX (1 bytes): 'R'
  528. [65] RX (1 bytes): 'R'
  529. [65] RX (1 bytes): 'O'
  530. [65] RX (1 bytes): 'R'
  531. [65] RX (1 bytes): '\r'
  532. [65] RX (1 bytes): '\n'
  533. [65] TX (8 bytes): 'INFO X\r\n'
  534. [65] recv() = -1
  535. [65] close()
  536. [65] result=0
  537.  
  538. === TEST 13 ===
  539. [50] RX (11 bytes): '200 LOGIN\r\n'
  540. [50] TX (4672 bytes): 'Robot4769727517262937291679982042... (truncated)'
  541. [62] RX (1 bytes): '2'
  542. [62] recv() = -1
  543. [62] close()
  544. [62] result=2
  545.  
  546. === TEST 14 ===
  547. [50] RX (11 bytes): '200 LOGIN\r\n'
  548. [50] TX (6 bytes): '\x00\r\n0\r\n'
  549. [62] RX (32 bytes): '201 PASSWORD\r\n500 LOGIN FAILED\r\n'
  550. [62] TX (8 bytes): 'INFO X\r\n'
  551. [62] close()
  552. [62] result=0
  553.  
  554. === TEST 15 ===
  555. [50] RX (11 bytes): '200 LOGIN\r\n'
  556. [50] TX (16 bytes): 'INFO X\r\nINFO X\r\n'
  557. [62] RX (32 bytes): '201 PASSWORD\r\n500 LOGIN FAILED\r\n'
  558. [62] TX (8 bytes): 'INFO X\r\n'
  559. [62] close()
  560. [62] result=0
  561.  
  562. Chyba 1
  563.  
  564. Server na zaslaný příkaz nereaguje (ačkoliv by měl). Timeout je na straně testovacího serveru nastaven na 10 sekund.
  565. Chyba 2
  566.  
  567. Spojení se serverem bylo přerušeno. Proces serveru možná spadnul (asi kvůli nějaké chybě ?).
  568. Chyba 3
  569.  
  570. Server neočekávaně uzavřel spojení.
  571. Chyba 100
  572.  
  573. Server neuzavřel spojení, ačkoliv měl tak učinit.
  574. Chyba 101
  575.  
  576. Očekávám zprávu '200 LOGIN'.
  577. Chyba 102
  578.  
  579. Očekávám zprávu '201 PASSWORD'.
  580. Chyba 103
  581.  
  582. Očekávám zprávu '202 OK'.
  583. Chyba 104
  584.  
  585. Očekávám zprávu '501 SYNTAX ERROR'. Možná, že místo této zprávy odeslal server 502 TIMEOUT, což znamená, že server neodesílá '501 SYNTAX ERROR' ihned po zjištění chybné syntaxe (viz zadání).
  586. Chyba 105
  587.  
  588. Očekávám zprávu '500 LOGIN FAILED'.
  589. Chyba 106
  590.  
  591. Očekávám zprávu '300 BAD CHECKSUM'. Možná, že místo této zprávy odeslal server 502 TIMEOUT, což znamená, že server nerozpoznal dobře konec zprávy FOTO.
  592. Chyba 998
  593.  
  594. Interní chyba testovacího nástroje. Prosím, ohlaste tuto chybu.
  595. Chyba 999
  596.  
  597. Interní chyba testovacího nástroje. Prosím, ohlaste tuto chybu.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement