c# - Identifying socket messages -


I have a code snippet at the bottom of a socket message, and I would like to know the order in which the message should be sent Return Because of not being in

Where the socket packet is a class that stores the received socket, and data length will be the length of the receiving message, the data buffer stores the message.

  Int number 3; Byte number 6 = 0; Socket packet workshoot; Int Datanghan; If (WorksheetsDataBuffer [0] == 0x33) {If (Data Legacy & lt; 0xbb) {return false; } (Num3 = 0; num3 & lt; 0xba; num3 ++) {num6 = (byte) (num6 + workSocket.dataBuffer [num3]); } // If the condition is to pass then ??? If (num6! = WorkSocket.dataBuffer [0xba]) {return false; }}   

Therefore,

  1. What message will be sent to the server, such as to pass the previous state? (According to my understanding, the message should be at least 187 in length and the first digit should be "3: .........................")
  2. What are 0xba, 0x33, 0xbb etc.? Hexadecimal? How should I rebuild the input message? To change these? Or ....? I have no meaning .......
  3. I tried to convert workSocket.dataBuffer [0 or 1 or any int] to a readable string. Convert.ToChar (workSocket.dataBuffer [0]) and workSocket.dataBuffer [0] .toString () Why does it give different results?

    Good, what do you have length messages (an 187 bytes message) There is a symbol to identify the beginning of the byte message, if the first byte is 0x33, then your code does not process the bytes in the buffer.

    Next, you have a checksum for the statement, it is adding the first 186 bytes to compare the result with the last byte ( Exact checksum < / Strong>). It is to make sure that the message is ok (and the way it is useless, because protocol is the stream / datagram lawyer).

    Then, about your questions:

    If last, what would be the message to send to the server to pass the situation?

    OK, you need to send 187-bytes-length message (just a byte [187]): First there should be a 0x33, next to the content and the last Bar must be checksum (you should calculate the same type in your snippet show)

      [0x33 | Content | CHKSUM] 0 1 185 186 For example: The following buffer has a valid message (one which will pass the condition). This just starts with the mark byte (0x33) and the next 185 bytes are zero (I do not specify the value), then checksum 0x33 + 0 + 0 + 0 + 0 ... 0 ... = 0x33  
      var buffer = new byte [187]; Buffer [0] = 0x33; Buffer [186] = 0x33;   

    What are 0xba, 0x33, 0xbb etc.? Hexadecimals?

    Yes, they are just numbers in hexadecimal.

    I tried to convert (thus) give different results why is it?

    Sets sent / received bytes (numbers only), but the real question is: why do you believe they should have text? Maybe those lessons are, yes, but who knows it is part of the protocol (protocol), which both agree on the endpoints and who allow them to exchange data, you need to know that those 185 bytes (187 - 1 byte mark for a byte mark - 1 byte checksum) means to act on them.

    Now, what you are doing is a reverse engineering, a protocol and that is why it is clear that you do not know the message format and I think you do not know what the content means , And when you are right and the content is text only, you still ignore the encoding used

    I hope this will help you.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -