Advertisement
Guest User

Untitled

a guest
Nov 10th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.67 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. Integer fotoLen = 0;
  29.  
  30. @Override
  31. public void run() {
  32.  
  33. DataInputStream inFromClient;
  34. try {
  35.  
  36. inFromClient = new DataInputStream(c.getInputStream());
  37. DataOutputStream outToClient = new DataOutputStream(c.getOutputStream());
  38. outToClient.writeBytes("200 LOGIN\r\n");
  39.  
  40.  
  41. Timer t = new Timer(45, new ActionListener() {
  42. @Override
  43. public void actionPerformed(ActionEvent e) {
  44. DataOutputStream outToClient;
  45. try {
  46. outToClient = new DataOutputStream(c.getOutputStream());
  47. outToClient.writeBytes("502 TIMEOUT\r\n");
  48. c.close();
  49. } catch (IOException ex) {
  50. Logger.getLogger(ClientListener.class.getName()).log(Level.SEVERE, null, ex);
  51. }
  52.  
  53. }
  54. });
  55.  
  56.  
  57.  
  58.  
  59. String writeDown = "";
  60. while (!writeDown.endsWith("\r\n")) {
  61. byte cc = inFromClient.readByte();
  62. writeDown += new String(new byte[]{cc}, "US-ASCII");
  63. }
  64. this.userName = writeDown.substring(0, writeDown.length() - 2);
  65. System.out.println("Received: " + c.getRemoteSocketAddress().toString() + ":" + writeDown);
  66.  
  67. outToClient.writeBytes("201 PASSWORD\r\n");
  68.  
  69. writeDown = "";
  70. while (!writeDown.endsWith("\r\n")) {
  71. byte cc = inFromClient.readByte();
  72. writeDown += new String(new byte[]{cc}, "US-ASCII");
  73. }
  74. this.password = writeDown.substring(0, writeDown.length() - 2);
  75. System.out.println("Received: " + c.getRemoteSocketAddress().toString() + ":" + writeDown);
  76.  
  77. if (!this.userName.startsWith("Robot")) {
  78. outToClient.writeBytes("500 LOGIN FAILED\r\n");
  79. c.close();
  80. return;
  81. }
  82.  
  83. Integer passwordAsItMustBe = 0;
  84. byte[] unb = this.userName.getBytes("US-ASCII");
  85. for (byte b : unb) {
  86. passwordAsItMustBe += b;
  87. }
  88. if (!this.password.equals(passwordAsItMustBe.toString())) {
  89. outToClient.writeBytes("500 LOGIN FAILED\r\n");
  90. c.close();
  91. return;
  92. }
  93. outToClient.writeBytes("202 OK\r\n");
  94.  
  95. while (true) {
  96.  
  97.  
  98. writeDown = "";
  99.  
  100. for (int j = 0; j < 5; j++) {
  101. byte cc = inFromClient.readByte();
  102. writeDown += new String(new byte[]{cc}, "US-ASCII");
  103. }
  104.  
  105. if (!"INFO ".equals(writeDown) || !"FOTO ".equals(writeDown)) {
  106. outToClient.writeBytes("501 SYNTAX ERROR\r\n");
  107. c.close();
  108. return;
  109. }
  110.  
  111. if ("INFO ".equals(writeDown)) {
  112. while (!writeDown.endsWith("\r\n")) {
  113. byte cc = inFromClient.readByte();
  114. writeDown += new String(new byte[]{cc}, "US-ASCII");
  115. }
  116. this.info = writeDown.substring(0, writeDown.length() - 2);
  117. System.out.println("Received: " + c.getRemoteSocketAddress().toString() + ":" + writeDown);
  118. outToClient.writeBytes("202 OK\r\n");
  119. }
  120.  
  121. File fnew = new File("foto0.png");
  122. BufferedImage originalImage = ImageIO.read(fnew);
  123. ByteArrayOutputStream baos = new ByteArrayOutputStream();
  124. ImageIO.write(originalImage, "png", baos);
  125. if ("FOTO ".equals(writeDown)) {
  126. while (!writeDown.endsWith(" ")) {
  127.  
  128. byte cc = inFromClient.readByte();
  129. writeDown += new String(new byte[]{cc}, "US-ASCII");
  130. len += new String(new byte[]{cc}, "US-ASCII");
  131.  
  132. }
  133. int intLen = Integer.parseInt(len);
  134.  
  135. boolean one = true;
  136.  
  137. String m = "";
  138. while (one) {
  139. byte cc = inFromClient.readByte();
  140. writeDown += new String(new byte[]{cc}, "US-ASCII");
  141. m += new String(new byte[]{cc}, "US-ASCII");
  142. one = false;
  143. }
  144. if (!" ".equals(m)) {
  145. outToClient.writeBytes("501 SYNTAX ERROR\r\n");
  146. c.close();
  147. return;
  148. }
  149.  
  150. for (int i = 0; i < intLen; i++) {
  151. byte[] b = new byte[1];
  152. foto = "";
  153. byte cc = inFromClient.readByte();
  154. writeDown += new String(new byte[]{cc}, "US-ASCII");
  155. foto += new String(new byte[]{cc}, "US-ASCII");
  156. fotoLen += Integer.parseInt(foto);
  157. b = baos.toByteArray();
  158. }
  159.  
  160. byte[] bytes = new byte[4];
  161. for (int i = 0; i < 4; i++) {
  162. byte cc = inFromClient.readByte();
  163. writeDown += new String(new byte[]{cc}, "US-ASCII");
  164. bytes[i] = cc;
  165. //ks += new String(new byte[]{cc}, "US-ASCII");
  166. }
  167. int value = 0;
  168. for (int i = 0; i <= 3; i++) {
  169. value = (value << 8) + (bytes[i] & 0xFF);
  170. }
  171.  
  172. if (fotoLen != value) {
  173. outToClient.writeBytes("300 BAD CHECKSUM\r\n");
  174. fnew.delete();
  175. c.close();
  176. return;
  177. }
  178. if (fotoLen == value) {
  179. outToClient.writeBytes("202 OK\r\n");
  180. ArrayList ar = new ArrayList();
  181. Random rn = new Random();
  182. int r = rn.nextInt(999) + 1;;
  183.  
  184. while (!ar.contains(r)) {
  185. r++;
  186. if (r > 999) {
  187. r = 1;
  188. }
  189.  
  190. }
  191. ar.add(r);
  192. File f = new File("foto" + r + ".png");
  193. fnew.renameTo(f);
  194. c.close();
  195. }
  196.  
  197. }
  198.  
  199.  
  200. }
  201.  
  202. //c.close();
  203. } catch (IOException ex) {
  204. System.err.println("Couldn't get I/O.");
  205. System.exit(1);
  206. }
  207.  
  208. }
  209.  
  210. }
  211.  
  212. class Server {
  213.  
  214. public static void svr_main(int port) throws IOException {
  215. ServerSocket serverSocket = null;
  216. try {
  217. serverSocket = new ServerSocket(port);
  218. } catch (IOException e) {
  219. System.err.println("Could not listen on port: " + port);
  220. System.exit(1);
  221. }
  222. Socket clientSocket = null;
  223. while (true) {
  224. try {
  225. clientSocket = serverSocket.accept();
  226. } catch (IOException e) {
  227. serverSocket.close();
  228. System.err.println("Accept failed.");
  229. System.exit(1);
  230. }
  231. System.out.println("client accepted from: " + clientSocket.getInetAddress()
  232. + ":" + clientSocket.getPort());
  233. ClientListener cl = new ClientListener(clientSocket);
  234. Thread thread = new Thread(cl);
  235. thread.start();
  236. }
  237. }
  238. }
  239.  
  240. public class Robot {
  241.  
  242. public static void main(String[] args) throws IOException {
  243. if (args.length == 0) {
  244. System.err.println("Server: java robot.Robot <port>");
  245. System.exit(1);
  246. }
  247. System.out.println("Starting server...\n");
  248. Server server = new Server();
  249. server.svr_main(Integer.parseInt(args[0]));
  250. }
  251. }
  252.  
  253.  
  254. === RESULTS ===
  255.  
  256. TEST 1: error 103
  257. TEST 2: error 103
  258. TEST 3: error 3
  259. TEST 4: ok
  260. TEST 5: ok
  261. TEST 6: error 2
  262. TEST 7: error 2
  263. TEST 8: error 2
  264. TEST 9: error 2
  265. TEST 10: error 103
  266. TEST 11: error 106
  267. TEST 12: ok
  268. TEST 13: error 2
  269. TEST 14: ok
  270. TEST 15: ok
  271.  
  272. === TEST 1 ===
  273. [49] RX (11 bytes): '200 LOGIN\r\n'
  274. [49] TX (15 bytes): 'Robot345\r\n674\r\n'
  275. [50] RX (1 bytes): '2'
  276. [50] RX (1 bytes): '0'
  277. [50] RX (1 bytes): '1'
  278. [50] RX (1 bytes): ' '
  279. [50] RX (1 bytes): 'P'
  280. [50] RX (1 bytes): 'A'
  281. [50] RX (1 bytes): 'S'
  282. [50] RX (1 bytes): 'S'
  283. [50] RX (1 bytes): 'W'
  284. [50] RX (1 bytes): 'O'
  285. [50] RX (1 bytes): 'R'
  286. [50] RX (1 bytes): 'D'
  287. [50] RX (1 bytes): '\r'
  288. [50] RX (1 bytes): '\n'
  289. [62] RX (1 bytes): '2'
  290. [62] RX (1 bytes): '0'
  291. [62] RX (1 bytes): '2'
  292. [63] RX (1 bytes): ' '
  293. [63] RX (1 bytes): 'O'
  294. [63] RX (1 bytes): 'K'
  295. [63] RX (1 bytes): '\r'
  296. [63] RX (1 bytes): '\n'
  297. [63] TX (45 bytes): 'INFO 2014-02-19 03:34 nefunkcni c... (truncated)'
  298. [63] RX (1 bytes): '5'
  299. [63] close()
  300. [63] result=103
  301.  
  302. === TEST 2 ===
  303. [49] RX (11 bytes): '200 LOGIN\r\n'
  304. [49] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
  305. [51] RX (1 bytes): '2'
  306. [51] RX (1 bytes): '0'
  307. [51] RX (1 bytes): '1'
  308. [51] RX (1 bytes): ' '
  309. [51] RX (1 bytes): 'P'
  310. [51] RX (1 bytes): 'A'
  311. [51] RX (1 bytes): 'S'
  312. [51] RX (1 bytes): 'S'
  313. [51] RX (1 bytes): 'W'
  314. [51] RX (1 bytes): 'O'
  315. [51] RX (1 bytes): 'R'
  316. [51] RX (1 bytes): 'D'
  317. [51] RX (1 bytes): '\r'
  318. [51] RX (1 bytes): '\n'
  319. [51] RX (1 bytes): '2'
  320. [51] RX (1 bytes): '0'
  321. [51] RX (1 bytes): '2'
  322. [51] RX (1 bytes): ' '
  323. [51] RX (1 bytes): 'O'
  324. [51] RX (1 bytes): 'K'
  325. [51] RX (1 bytes): '\r'
  326. [51] RX (1 bytes): '\n'
  327. [51] TX (22 bytes): 'INFO \r \n\r \n \r\nINFO \r\nX'
  328. [51] RX (1 bytes): '5'
  329. [51] close()
  330. [51] result=103
  331.  
  332. === TEST 3 ===
  333. [49] RX (11 bytes): '200 LOGIN\r\n'
  334. [49] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
  335. [62] RX (5 bytes): '201 P'
  336. [65] RX (17 bytes): 'ASSWORD\r\n202 OK\r\n'
  337. [65] TX (2 bytes): '\r\n'
  338. [389] close()
  339. [389] result=3
  340.  
  341. === TEST 4 ===
  342. [49] RX (11 bytes): '200 LOGIN\r\n'
  343. [49] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
  344. [62] RX (32 bytes): '201 PASSWORD\r\n500 LOGIN FAILED\r\n'
  345. [62] TX (8 bytes): 'INFO X\r\n'
  346. [62] close()
  347. [62] result=0
  348.  
  349. === TEST 5 ===
  350. [49] RX (11 bytes): '200 LOGIN\r\n'
  351. [49] TX (2 bytes): '\r\n'
  352. [52] RX (2 bytes): '20'
  353. [52] RX (2 bytes): '1 '
  354. [62] RX (1 bytes): 'P'
  355. [62] RX (9 bytes): 'ASSWORD\r\n'
  356. [62] TX (2 bytes): '\r\n'
  357. [62] RX (18 bytes): '500 LOGIN FAILED\r\n'
  358. [62] TX (8 bytes): 'INFO X\r\n'
  359. [62] close()
  360. [62] result=0
  361.  
  362. === TEST 6 ===
  363. [49] RX (11 bytes): '200 LOGIN\r\n'
  364. [49] TX (8192 bytes): 'Robot \xc7\xde\x0c,\x84&dq\x87\xfe\x13\x9f\x11|\x95a"\x1dGy\x05\x16Z\xdfi$\x8d... (truncated)'
  365. [49] TX (8192 bytes): '\xae\xaa\x9a$,\x1e$\xb1G\xa4\xdfL"\xad\x8e\x9axf5\x0e\xff\x8c3Yf\x9ap\xee\xbc\xe1\xeaj\x8b... (truncated)'
  366. [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)'
  367. [49] TX (8192 bytes): '\xa2\xfc\x10\x1b\x06 _\x7f2BK\xd1n4\x06\xc8U\xf2l#\xa74\n-\x05\x8ce\x18\x11%\xe3\xb3!... (truncated)'
  368. [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)'
  369. [49] TX (8192 bytes): '?$d\x82\x9e\x93\xfe\x9d\xf2\xb1+\x1aK'%\xc6@)\xa2=\x9c\xf3X_,\xc5n\xfd\xd64\xde\x16X... (truncated)'
  370. [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)'
  371. [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)'
  372. [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)'
  373. [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)'
  374. [49] TX (8192 bytes): '\xec\xbf#\xd8\xf4N\xd2E@\xc9\xe0\xe6\xae6N\x05\xf2c,"p\xea\x10a\xf6\xc4qI\xe3Ma\xd0\x0c... (truncated)'
  375. [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)'
  376. [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)'
  377. [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)'
  378. [49] Waiting for receiver
  379. [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)'
  380. [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)'
  381. [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)'
  382. [62] TX (8192 bytes): '~\x001{\xe4\xf1,\x11s\xbc)\xb2\x12Z\xdc\xbf\xf3\x82\x13|,\x00\xfdH3\xda\x16\xb5\xd4Q\x11RQ... (truncated)'
  383. [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)'
  384. [62] TX (8192 bytes): '"c\xd6\xf1ry_\xf70mR\xc7\xc4\xb6e\xda\xf6\xd5F@'\xccn\xb9\xfe\x07\xdc\xbb;\xf1\x1c]T... (truncated)'
  385. [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)'
  386. [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)'
  387. [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)'
  388. [62] TX (8192 bytes): '`1=Z\xd3Ekp-\xb0\xc5\x1a\xdfk\xb7\x94}\x02:\x85\xf3\xb2\xfdMO$vL@SG\xa0\x84... (truncated)'
  389. [62] TX (8192 bytes): '\x14~\xd6\x10V*\xe3\x8fe\xdfl\x8cq\xea{\xce\x82\xfcK=\x9a\xe0xN\xf6\xbd|\xc1GK\x0c[\xc9... (truncated)'
  390. [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)'
  391. [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)'
  392. [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)'
  393. [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)'
  394. [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)'
  395. [62] Waiting for receiver
  396. [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)'
  397. [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)'
  398. [93] Waiting for receiver
  399. [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)'
  400. [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)'
  401. [137] Waiting for receiver
  402. [389] recv() = -1
  403. [389] close()
  404. [389] result=2
  405.  
  406. === TEST 7 ===
  407. [49] RX (11 bytes): '200 LOGIN\r\n'
  408. [49] TX (5 bytes): '\x00\x00\x00\x00\x00'
  409. [250] TX (2 bytes): '\x00\r'
  410. [389] recv() = -1
  411. [389] close()
  412. [389] result=2
  413.  
  414. === TEST 8 ===
  415. [49] RX (11 bytes): '200 LOGIN\r\n'
  416. [49] TX (10 bytes): 'Robot\x00\x00\x00\x00\x00'
  417. [250] TX (2 bytes): '\x00\r'
  418. [389] recv() = -1
  419. [389] close()
  420. [389] result=2
  421.  
  422. === TEST 9 ===
  423. [49] RX (11 bytes): '200 LOGIN\r\n'
  424. [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)'
  425. [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)'
  426. [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)'
  427. [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)'
  428. [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)'
  429. [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)'
  430. [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)'
  431. [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)'
  432. [50] TX (8192 bytes): ',\xfdM\xcc\xfaH{\xed\xc9\xc0\x97w\xc3\xe2\x89\xbdA\xb1\xeaPU4z6\xf5\xe4\xa6gn\xc5&\x9b\xc2... (truncated)'
  433. [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)'
  434. [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)'
  435. [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)'
  436. [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)'
  437. [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)'
  438. [50] Waiting for receiver
  439. [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)'
  440. [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)'
  441. [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)'
  442. [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)'
  443. [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)'
  444. [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)'
  445. [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)'
  446. [62] TX (8192 bytes): '\xf4x=PHJ#\x9f\xa8\x86\xc9(\xd4\x012\xb3\xfb\x0e\xbe\xf3D8F\xcc+'\xdcc\xd0\xcdl\xc5F... (truncated)'
  447. [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)'
  448. [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)'
  449. [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)'
  450. [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)'
  451. [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)'
  452. [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)'
  453. [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)'
  454. [62] TX (8192 bytes): '(\x05/4\xadD\x8f\x8aZ\x86\xf5((\xd5\x1e\xb1\x99\x192a\x1c[J{\x01\x06^\xa2J\x04Dr\x09... (truncated)'
  455. [62] Waiting for receiver
  456. [93] TX (8192 bytes): '\x11\xbb\x1a\xdeiOZN~uj\xad\xd2\xa9WP\\xd8n\x02\xc1Q\xed_\xfc\xdfp\x12y{\x8a\x8a6... (truncated)'
  457. [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)'
  458. [93] Waiting for receiver
  459. [137] TX (8192 bytes): '\xcev\x10\xc9\xb1r\x18\xd5"\x87d\xc5\rVQ;\x81;\x17$\xd0\xee.\x1c/\xfc\x12)\xa4oJr\xe5... (truncated)'
  460. [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)'
  461. [137] Waiting for receiver
  462. [389] recv() = -1
  463. [389] close()
  464. [389] result=2
  465.  
  466. === TEST 10 ===
  467. [50] RX (11 bytes): '200 LOGIN\r\n'
  468. [50] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
  469. [62] RX (5 bytes): '201 P'
  470. [65] RX (17 bytes): 'ASSWORD\r\n202 OK\r\n'
  471. [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)'
  472. [65] RX (1 bytes): '5'
  473. [65] close()
  474. [65] result=103
  475.  
  476. === TEST 11 ===
  477. [50] RX (11 bytes): '200 LOGIN\r\n'
  478. [50] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
  479. [62] RX (5 bytes): '201 P'
  480. [62] RX (17 bytes): 'ASSWORD\r\n202 OK\r\n'
  481. [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)'
  482. [62] RX (1 bytes): '5'
  483. [62] close()
  484. [62] result=106
  485.  
  486. === TEST 12 ===
  487. [50] RX (11 bytes): '200 LOGIN\r\n'
  488. [50] TX (118 bytes): 'Robot4769727517262937291679982042... (truncated)'
  489. [64] RX (1 bytes): '2'
  490. [64] RX (1 bytes): '0'
  491. [64] RX (1 bytes): '1'
  492. [64] RX (1 bytes): ' '
  493. [64] RX (1 bytes): 'P'
  494. [64] RX (1 bytes): 'A'
  495. [64] RX (1 bytes): 'S'
  496. [64] RX (1 bytes): 'S'
  497. [64] RX (1 bytes): 'W'
  498. [64] RX (1 bytes): 'O'
  499. [64] RX (1 bytes): 'R'
  500. [64] RX (1 bytes): 'D'
  501. [64] RX (1 bytes): '\r'
  502. [64] RX (1 bytes): '\n'
  503. [64] RX (1 bytes): '2'
  504. [64] RX (1 bytes): '0'
  505. [64] RX (1 bytes): '2'
  506. [64] RX (1 bytes): ' '
  507. [64] RX (1 bytes): 'O'
  508. [65] RX (1 bytes): 'K'
  509. [65] RX (1 bytes): '\r'
  510. [65] RX (1 bytes): '\n'
  511. [65] RX (1 bytes): '5'
  512. [65] RX (1 bytes): '0'
  513. [65] RX (1 bytes): '1'
  514. [65] RX (1 bytes): ' '
  515. [65] RX (1 bytes): 'S'
  516. [65] RX (1 bytes): 'Y'
  517. [65] RX (1 bytes): 'N'
  518. [65] RX (1 bytes): 'T'
  519. [65] RX (1 bytes): 'A'
  520. [65] RX (1 bytes): 'X'
  521. [65] RX (1 bytes): ' '
  522. [65] RX (1 bytes): 'E'
  523. [65] RX (1 bytes): 'R'
  524. [65] RX (1 bytes): 'R'
  525. [65] RX (1 bytes): 'O'
  526. [65] RX (1 bytes): 'R'
  527. [65] RX (1 bytes): '\r'
  528. [65] RX (1 bytes): '\n'
  529. [65] TX (8 bytes): 'INFO X\r\n'
  530. [65] recv() = -1
  531. [65] close()
  532. [65] result=0
  533.  
  534. === TEST 13 ===
  535. [50] RX (11 bytes): '200 LOGIN\r\n'
  536. [50] TX (4672 bytes): 'Robot4769727517262937291679982042... (truncated)'
  537. [62] RX (1 bytes): '2'
  538. [62] recv() = -1
  539. [62] close()
  540. [62] result=2
  541.  
  542. === TEST 14 ===
  543. [50] RX (11 bytes): '200 LOGIN\r\n'
  544. [50] TX (6 bytes): '\x00\r\n0\r\n'
  545. [62] RX (32 bytes): '201 PASSWORD\r\n500 LOGIN FAILED\r\n'
  546. [62] TX (8 bytes): 'INFO X\r\n'
  547. [62] close()
  548. [62] result=0
  549.  
  550. === TEST 15 ===
  551. [50] RX (11 bytes): '200 LOGIN\r\n'
  552. [50] TX (16 bytes): 'INFO X\r\nINFO X\r\n'
  553. [62] RX (32 bytes): '201 PASSWORD\r\n500 LOGIN FAILED\r\n'
  554. [62] TX (8 bytes): 'INFO X\r\n'
  555. [62] close()
  556. [62] result=0
  557.  
  558. Chyba 1
  559.  
  560. Server na zaslaný příkaz nereaguje (ačkoliv by měl). Timeout je na straně testovacího serveru nastaven na 10 sekund.
  561. Chyba 2
  562.  
  563. Spojení se serverem bylo přerušeno. Proces serveru možná spadnul (asi kvůli nějaké chybě ?).
  564. Chyba 3
  565.  
  566. Server neočekávaně uzavřel spojení.
  567. Chyba 100
  568.  
  569. Server neuzavřel spojení, ačkoliv měl tak učinit.
  570. Chyba 101
  571.  
  572. Očekávám zprávu '200 LOGIN'.
  573. Chyba 102
  574.  
  575. Očekávám zprávu '201 PASSWORD'.
  576. Chyba 103
  577.  
  578. Očekávám zprávu '202 OK'.
  579. Chyba 104
  580.  
  581. 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í).
  582. Chyba 105
  583.  
  584. Očekávám zprávu '500 LOGIN FAILED'.
  585. Chyba 106
  586.  
  587. 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.
  588. Chyba 998
  589.  
  590. Interní chyba testovacího nástroje. Prosím, ohlaste tuto chybu.
  591. Chyba 999
  592.  
  593. Interní chyba testovacího nástroje. Prosím, ohlaste tuto chybu.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement