Understanding original code

Forum Home Forums Development and Integration Understanding original code

This topic contains 1 reply, has 2 voices, and was last updated by Mikhail Mikhail 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4867
    linkangsun
    linkangsun
    Participant

    Hi,

    In the file,ScadaData.Client.ServerComm.cs,there is a method,CheckUser,where,
    buf[0] = (byte)(buf.Length % 256);
    buf[1] = (byte)(buf.Length / 256);
    buf[2] = 0x01;
    buf[3] = userLen;
    why “%256”, “/256”,what it is doing, I really do not understand.
    And it is not the exception,there are many similar doing in other situations,such as in method,SendSrez,
    byte[] buf = new byte[cmdLen];
    buf[0] = (byte)(cmdLen % 256);
    buf[1] = (byte)(cmdLen / 256);
    buf[2] = 0x03;
    buf[3] = (byte)(cnlCnt % 256);
    buf[4] = (byte)(cnlCnt / 256);

    • This topic was modified 7 months ago by Mikhail Mikhail.
    #4874
    Mikhail
    Mikhail
    Moderator

    Hi,

    why “%256”, “/256”,what it is doing, I really do not understand.

    Gets lo and hi bytes of the integer.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.