Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Alexander Maksimov
- package robot;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.image.BufferedImage;
- import java.net.*;
- import java.io.*;
- import javax.swing.Timer;
- import java.util.ArrayList;
- import java.util.Random;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import javax.imageio.ImageIO;
- class ClientListener implements Runnable {
- Socket c;
- public ClientListener(Socket c) {
- this.c = c;
- }
- String userName;
- String password;
- String info;
- String len;
- String foto;
- String FILE = "foto0.png";
- Integer fotoLen = 0;
- String ks;
- @Override
- public void run() {
- DataInputStream inFromClient;
- try {
- inFromClient = new DataInputStream(c.getInputStream());
- DataOutputStream outToClient = new DataOutputStream(c.getOutputStream());
- outToClient.writeBytes("200 LOGIN\r\n");
- // Timer t = new Timer(45, new ActionListener() {
- // @Override
- // public void actionPerformed(ActionEvent e) {
- // DataOutputStream outToClient;
- // try {
- // outToClient = new DataOutputStream(c.getOutputStream());
- // outToClient.writeBytes("502 TIMEOUT\r\n");
- // c.close();
- // } catch (IOException ex) {
- // Logger.getLogger(ClientListener.class.getName()).log(Level.SEVERE, null, ex);
- // }
- //
- // }
- // });
- String writeDown = "";
- while (!writeDown.endsWith("\r\n")) {
- byte cc = inFromClient.readByte();
- writeDown += new String(new byte[]{cc}, "US-ASCII");
- }
- this.userName = writeDown.substring(0, writeDown.length() - 2);
- System.out.println("Received: " + c.getRemoteSocketAddress().toString() + ":" + writeDown);
- outToClient.writeBytes("201 PASSWORD\r\n");
- writeDown = "";
- while (!writeDown.endsWith("\r\n")) {
- byte cc = inFromClient.readByte();
- writeDown += new String(new byte[]{cc}, "US-ASCII");
- }
- this.password = writeDown.substring(0, writeDown.length() - 2);
- System.out.println("Received: " + c.getRemoteSocketAddress().toString() + ":" + writeDown);
- if (!this.userName.startsWith("Robot")) {
- outToClient.writeBytes("500 LOGIN FAILED\r\n");
- c.close();
- return;
- }
- Integer passwordAsItMustBe = 0;
- byte[] unb = this.userName.getBytes("US-ASCII");
- for (byte b : unb) {
- passwordAsItMustBe += b;
- }
- if (!this.password.equals(passwordAsItMustBe.toString())) {
- outToClient.writeBytes("500 LOGIN FAILED\r\n");
- c.close();
- return;
- }
- outToClient.writeBytes("202 OK\r\n");
- while (true) {
- writeDown = "";
- for (int j = 0; j < 5; j++) {
- byte cc = inFromClient.readByte();
- writeDown += new String(new byte[]{cc}, "US-ASCII");
- }
- if (!"INFO ".equals(writeDown) || !"FOTO ".equals(writeDown)) {
- outToClient.writeBytes("501 SYNTAX ERROR\r\n");
- c.close();
- return;
- }
- if ("INFO ".equals(writeDown)) {
- while (!writeDown.endsWith("\r\n")) {
- byte cc = inFromClient.readByte();
- writeDown += new String(new byte[]{cc}, "US-ASCII");
- }
- this.info = writeDown.substring(0, writeDown.length() - 2);
- System.out.println("Received: " + c.getRemoteSocketAddress().toString() + ":" + writeDown);
- outToClient.writeBytes("202 OK\r\n");
- }
- File fnew = new File("foto0.png");
- BufferedImage originalImage = ImageIO.read(fnew);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ImageIO.write(originalImage, "png", baos);
- if ("FOTO ".equals(writeDown)) {
- while (!writeDown.endsWith(" ")) {
- byte cc = inFromClient.readByte();
- writeDown += new String(new byte[]{cc}, "US-ASCII");
- len += new String(new byte[]{cc}, "US-ASCII");
- }
- int intLen = Integer.parseInt(len);
- boolean one = true;
- String m = "";
- while (one) {
- byte cc = inFromClient.readByte();
- writeDown += new String(new byte[]{cc}, "US-ASCII");
- m += new String(new byte[]{cc}, "US-ASCII");
- one = false;
- }
- if (!" ".equals(m)) {
- outToClient.writeBytes("501 SYNTAX ERROR\r\n");
- c.close();
- return;
- }
- for (int i = 0; i < intLen; i++) {
- byte[] b = new byte[1];
- foto = "";
- byte cc = inFromClient.readByte();
- writeDown += new String(new byte[]{cc}, "US-ASCII");
- foto += new String(new byte[]{cc}, "US-ASCII");
- fotoLen += Integer.parseInt(foto);
- b = baos.toByteArray();
- }
- byte[] bytes = new byte[4];
- for (int i = 0; i < 4; i++) {
- byte cc = inFromClient.readByte();
- writeDown += new String(new byte[]{cc}, "US-ASCII");
- bytes[i] = cc;
- //ks += new String(new byte[]{cc}, "US-ASCII");
- }
- int value = 0;
- for (int i = 0; i <= 3; i++) {
- value = (value << 8) + (bytes[i] & 0xFF);
- }
- if (fotoLen != value) {
- outToClient.writeBytes("300 BAD CHECKSUM\r\n");
- fnew.delete();
- return;
- }
- if (fotoLen == value) {
- outToClient.writeBytes("202 OK\r\n");
- ArrayList ar = new ArrayList();
- Random rn = new Random();
- int r = rn.nextInt(999) + 1;
- while (!ar.contains(r)) {
- r++;
- if (r > 999) {
- r = 1;
- }
- }
- ar.add(r);
- File f = new File("foto" + r + ".png");
- fnew.renameTo(f);
- //c.close();
- }
- }
- }
- //c.close();
- } catch (IOException ex) {
- System.err.println("Couldn't get I/O.");
- System.exit(1);
- }
- }
- }
- class Server {
- public static void svr_main(int port) throws IOException {
- ServerSocket serverSocket = null;
- try {
- serverSocket = new ServerSocket(port);
- } catch (IOException e) {
- System.err.println("Could not listen on port: " + port);
- System.exit(1);
- }
- Socket clientSocket = null;
- while (true) {
- try {
- clientSocket = serverSocket.accept();
- } catch (IOException e) {
- serverSocket.close();
- System.err.println("Accept failed.");
- System.exit(1);
- }
- System.out.println("client accepted from: " + clientSocket.getInetAddress()
- + ":" + clientSocket.getPort());
- ClientListener cl = new ClientListener(clientSocket);
- Thread thread = new Thread(cl);
- thread.start();
- }
- }
- }
- public class Robot {
- public static void main(String[] args) throws IOException {
- if (args.length == 0) {
- System.err.println("Server: java robot.Robot <port>");
- System.exit(1);
- }
- System.out.println("Starting server...\n");
- Server server = new Server();
- server.svr_main(Integer.parseInt(args[0]));
- }
- }
- === RESULTS ===
- TEST 1: error 103
- TEST 2: error 103
- TEST 3: error 3
- TEST 4: ok
- TEST 5: ok
- TEST 6: error 2
- TEST 7: error 2
- TEST 8: error 2
- TEST 9: error 2
- TEST 10: error 103
- TEST 11: error 106
- TEST 12: ok
- TEST 13: error 2
- TEST 14: ok
- TEST 15: ok
- === TEST 1 ===
- [49] RX (11 bytes): '200 LOGIN\r\n'
- [49] TX (15 bytes): 'Robot345\r\n674\r\n'
- [50] RX (1 bytes): '2'
- [50] RX (1 bytes): '0'
- [50] RX (1 bytes): '1'
- [50] RX (1 bytes): ' '
- [50] RX (1 bytes): 'P'
- [50] RX (1 bytes): 'A'
- [50] RX (1 bytes): 'S'
- [50] RX (1 bytes): 'S'
- [50] RX (1 bytes): 'W'
- [50] RX (1 bytes): 'O'
- [50] RX (1 bytes): 'R'
- [50] RX (1 bytes): 'D'
- [50] RX (1 bytes): '\r'
- [50] RX (1 bytes): '\n'
- [62] RX (1 bytes): '2'
- [62] RX (1 bytes): '0'
- [62] RX (1 bytes): '2'
- [63] RX (1 bytes): ' '
- [63] RX (1 bytes): 'O'
- [63] RX (1 bytes): 'K'
- [63] RX (1 bytes): '\r'
- [63] RX (1 bytes): '\n'
- [63] TX (45 bytes): 'INFO 2014-02-19 03:34 nefunkcni c... (truncated)'
- [63] RX (1 bytes): '5'
- [63] close()
- [63] result=103
- === TEST 2 ===
- [49] RX (11 bytes): '200 LOGIN\r\n'
- [49] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
- [51] RX (1 bytes): '2'
- [51] RX (1 bytes): '0'
- [51] RX (1 bytes): '1'
- [51] RX (1 bytes): ' '
- [51] RX (1 bytes): 'P'
- [51] RX (1 bytes): 'A'
- [51] RX (1 bytes): 'S'
- [51] RX (1 bytes): 'S'
- [51] RX (1 bytes): 'W'
- [51] RX (1 bytes): 'O'
- [51] RX (1 bytes): 'R'
- [51] RX (1 bytes): 'D'
- [51] RX (1 bytes): '\r'
- [51] RX (1 bytes): '\n'
- [51] RX (1 bytes): '2'
- [51] RX (1 bytes): '0'
- [51] RX (1 bytes): '2'
- [51] RX (1 bytes): ' '
- [51] RX (1 bytes): 'O'
- [51] RX (1 bytes): 'K'
- [51] RX (1 bytes): '\r'
- [51] RX (1 bytes): '\n'
- [51] TX (22 bytes): 'INFO \r \n\r \n \r\nINFO \r\nX'
- [51] RX (1 bytes): '5'
- [51] close()
- [51] result=103
- === TEST 3 ===
- [49] RX (11 bytes): '200 LOGIN\r\n'
- [49] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
- [62] RX (5 bytes): '201 P'
- [65] RX (17 bytes): 'ASSWORD\r\n202 OK\r\n'
- [65] TX (2 bytes): '\r\n'
- [389] close()
- [389] result=3
- === TEST 4 ===
- [49] RX (11 bytes): '200 LOGIN\r\n'
- [49] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
- [62] RX (32 bytes): '201 PASSWORD\r\n500 LOGIN FAILED\r\n'
- [62] TX (8 bytes): 'INFO X\r\n'
- [62] close()
- [62] result=0
- === TEST 5 ===
- [49] RX (11 bytes): '200 LOGIN\r\n'
- [49] TX (2 bytes): '\r\n'
- [52] RX (2 bytes): '20'
- [52] RX (2 bytes): '1 '
- [62] RX (1 bytes): 'P'
- [62] RX (9 bytes): 'ASSWORD\r\n'
- [62] TX (2 bytes): '\r\n'
- [62] RX (18 bytes): '500 LOGIN FAILED\r\n'
- [62] TX (8 bytes): 'INFO X\r\n'
- [62] close()
- [62] result=0
- === TEST 6 ===
- [49] RX (11 bytes): '200 LOGIN\r\n'
- [49] TX (8192 bytes): 'Robot \xc7\xde\x0c,\x84&dq\x87\xfe\x13\x9f\x11|\x95a"\x1dGy\x05\x16Z\xdfi$\x8d... (truncated)'
- [49] TX (8192 bytes): '\xae\xaa\x9a$,\x1e$\xb1G\xa4\xdfL"\xad\x8e\x9axf5\x0e\xff\x8c3Yf\x9ap\xee\xbc\xe1\xeaj\x8b... (truncated)'
- [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)'
- [49] TX (8192 bytes): '\xa2\xfc\x10\x1b\x06 _\x7f2BK\xd1n4\x06\xc8U\xf2l#\xa74\n-\x05\x8ce\x18\x11%\xe3\xb3!... (truncated)'
- [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)'
- [49] TX (8192 bytes): '?$d\x82\x9e\x93\xfe\x9d\xf2\xb1+\x1aK'%\xc6@)\xa2=\x9c\xf3X_,\xc5n\xfd\xd64\xde\x16X... (truncated)'
- [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)'
- [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)'
- [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)'
- [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)'
- [49] TX (8192 bytes): '\xec\xbf#\xd8\xf4N\xd2E@\xc9\xe0\xe6\xae6N\x05\xf2c,"p\xea\x10a\xf6\xc4qI\xe3Ma\xd0\x0c... (truncated)'
- [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)'
- [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)'
- [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)'
- [49] Waiting for receiver
- [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)'
- [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)'
- [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)'
- [62] TX (8192 bytes): '~\x001{\xe4\xf1,\x11s\xbc)\xb2\x12Z\xdc\xbf\xf3\x82\x13|,\x00\xfdH3\xda\x16\xb5\xd4Q\x11RQ... (truncated)'
- [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)'
- [62] TX (8192 bytes): '"c\xd6\xf1ry_\xf70mR\xc7\xc4\xb6e\xda\xf6\xd5F@'\xccn\xb9\xfe\x07\xdc\xbb;\xf1\x1c]T... (truncated)'
- [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)'
- [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)'
- [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)'
- [62] TX (8192 bytes): '`1=Z\xd3Ekp-\xb0\xc5\x1a\xdfk\xb7\x94}\x02:\x85\xf3\xb2\xfdMO$vL@SG\xa0\x84... (truncated)'
- [62] TX (8192 bytes): '\x14~\xd6\x10V*\xe3\x8fe\xdfl\x8cq\xea{\xce\x82\xfcK=\x9a\xe0xN\xf6\xbd|\xc1GK\x0c[\xc9... (truncated)'
- [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)'
- [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)'
- [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)'
- [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)'
- [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)'
- [62] Waiting for receiver
- [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)'
- [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)'
- [93] Waiting for receiver
- [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)'
- [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)'
- [137] Waiting for receiver
- [389] recv() = -1
- [389] close()
- [389] result=2
- === TEST 7 ===
- [49] RX (11 bytes): '200 LOGIN\r\n'
- [49] TX (5 bytes): '\x00\x00\x00\x00\x00'
- [250] TX (2 bytes): '\x00\r'
- [389] recv() = -1
- [389] close()
- [389] result=2
- === TEST 8 ===
- [49] RX (11 bytes): '200 LOGIN\r\n'
- [49] TX (10 bytes): 'Robot\x00\x00\x00\x00\x00'
- [250] TX (2 bytes): '\x00\r'
- [389] recv() = -1
- [389] close()
- [389] result=2
- === TEST 9 ===
- [49] RX (11 bytes): '200 LOGIN\r\n'
- [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)'
- [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)'
- [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)'
- [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)'
- [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)'
- [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)'
- [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)'
- [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)'
- [50] TX (8192 bytes): ',\xfdM\xcc\xfaH{\xed\xc9\xc0\x97w\xc3\xe2\x89\xbdA\xb1\xeaPU4z6\xf5\xe4\xa6gn\xc5&\x9b\xc2... (truncated)'
- [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)'
- [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)'
- [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)'
- [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)'
- [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)'
- [50] Waiting for receiver
- [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)'
- [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)'
- [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)'
- [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)'
- [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)'
- [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)'
- [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)'
- [62] TX (8192 bytes): '\xf4x=PHJ#\x9f\xa8\x86\xc9(\xd4\x012\xb3\xfb\x0e\xbe\xf3D8F\xcc+'\xdcc\xd0\xcdl\xc5F... (truncated)'
- [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)'
- [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)'
- [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)'
- [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)'
- [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)'
- [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)'
- [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)'
- [62] TX (8192 bytes): '(\x05/4\xadD\x8f\x8aZ\x86\xf5((\xd5\x1e\xb1\x99\x192a\x1c[J{\x01\x06^\xa2J\x04Dr\x09... (truncated)'
- [62] Waiting for receiver
- [93] TX (8192 bytes): '\x11\xbb\x1a\xdeiOZN~uj\xad\xd2\xa9WP\\xd8n\x02\xc1Q\xed_\xfc\xdfp\x12y{\x8a\x8a6... (truncated)'
- [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)'
- [93] Waiting for receiver
- [137] TX (8192 bytes): '\xcev\x10\xc9\xb1r\x18\xd5"\x87d\xc5\rVQ;\x81;\x17$\xd0\xee.\x1c/\xfc\x12)\xa4oJr\xe5... (truncated)'
- [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)'
- [137] Waiting for receiver
- [389] recv() = -1
- [389] close()
- [389] result=2
- === TEST 10 ===
- [50] RX (11 bytes): '200 LOGIN\r\n'
- [50] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
- [62] RX (5 bytes): '201 P'
- [65] RX (17 bytes): 'ASSWORD\r\n202 OK\r\n'
- [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)'
- [65] RX (1 bytes): '5'
- [65] close()
- [65] result=103
- === TEST 11 ===
- [50] RX (11 bytes): '200 LOGIN\r\n'
- [50] TX (111 bytes): 'Robot4769727517262937291679982042... (truncated)'
- [62] RX (5 bytes): '201 P'
- [62] RX (17 bytes): 'ASSWORD\r\n202 OK\r\n'
- [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)'
- [62] RX (1 bytes): '5'
- [62] close()
- [62] result=106
- === TEST 12 ===
- [50] RX (11 bytes): '200 LOGIN\r\n'
- [50] TX (118 bytes): 'Robot4769727517262937291679982042... (truncated)'
- [64] RX (1 bytes): '2'
- [64] RX (1 bytes): '0'
- [64] RX (1 bytes): '1'
- [64] RX (1 bytes): ' '
- [64] RX (1 bytes): 'P'
- [64] RX (1 bytes): 'A'
- [64] RX (1 bytes): 'S'
- [64] RX (1 bytes): 'S'
- [64] RX (1 bytes): 'W'
- [64] RX (1 bytes): 'O'
- [64] RX (1 bytes): 'R'
- [64] RX (1 bytes): 'D'
- [64] RX (1 bytes): '\r'
- [64] RX (1 bytes): '\n'
- [64] RX (1 bytes): '2'
- [64] RX (1 bytes): '0'
- [64] RX (1 bytes): '2'
- [64] RX (1 bytes): ' '
- [64] RX (1 bytes): 'O'
- [65] RX (1 bytes): 'K'
- [65] RX (1 bytes): '\r'
- [65] RX (1 bytes): '\n'
- [65] RX (1 bytes): '5'
- [65] RX (1 bytes): '0'
- [65] RX (1 bytes): '1'
- [65] RX (1 bytes): ' '
- [65] RX (1 bytes): 'S'
- [65] RX (1 bytes): 'Y'
- [65] RX (1 bytes): 'N'
- [65] RX (1 bytes): 'T'
- [65] RX (1 bytes): 'A'
- [65] RX (1 bytes): 'X'
- [65] RX (1 bytes): ' '
- [65] RX (1 bytes): 'E'
- [65] RX (1 bytes): 'R'
- [65] RX (1 bytes): 'R'
- [65] RX (1 bytes): 'O'
- [65] RX (1 bytes): 'R'
- [65] RX (1 bytes): '\r'
- [65] RX (1 bytes): '\n'
- [65] TX (8 bytes): 'INFO X\r\n'
- [65] recv() = -1
- [65] close()
- [65] result=0
- === TEST 13 ===
- [50] RX (11 bytes): '200 LOGIN\r\n'
- [50] TX (4672 bytes): 'Robot4769727517262937291679982042... (truncated)'
- [62] RX (1 bytes): '2'
- [62] recv() = -1
- [62] close()
- [62] result=2
- === TEST 14 ===
- [50] RX (11 bytes): '200 LOGIN\r\n'
- [50] TX (6 bytes): '\x00\r\n0\r\n'
- [62] RX (32 bytes): '201 PASSWORD\r\n500 LOGIN FAILED\r\n'
- [62] TX (8 bytes): 'INFO X\r\n'
- [62] close()
- [62] result=0
- === TEST 15 ===
- [50] RX (11 bytes): '200 LOGIN\r\n'
- [50] TX (16 bytes): 'INFO X\r\nINFO X\r\n'
- [62] RX (32 bytes): '201 PASSWORD\r\n500 LOGIN FAILED\r\n'
- [62] TX (8 bytes): 'INFO X\r\n'
- [62] close()
- [62] result=0
- Chyba 1
- Server na zaslaný příkaz nereaguje (ačkoliv by měl). Timeout je na straně testovacího serveru nastaven na 10 sekund.
- Chyba 2
- Spojení se serverem bylo přerušeno. Proces serveru možná spadnul (asi kvůli nějaké chybě ?).
- Chyba 3
- Server neočekávaně uzavřel spojení.
- Chyba 100
- Server neuzavřel spojení, ačkoliv měl tak učinit.
- Chyba 101
- Očekávám zprávu '200 LOGIN'.
- Chyba 102
- Očekávám zprávu '201 PASSWORD'.
- Chyba 103
- Očekávám zprávu '202 OK'.
- Chyba 104
- 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í).
- Chyba 105
- Očekávám zprávu '500 LOGIN FAILED'.
- Chyba 106
- 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.
- Chyba 998
- Interní chyba testovacího nástroje. Prosím, ohlaste tuto chybu.
- Chyba 999
- Interní chyba testovacího nástroje. Prosím, ohlaste tuto chybu.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement