It is required to implement the transmission of an array of bytes over TCP protocol The custom protocol: the first 3 bytes will be constantly changing, then 2 bytes are always static, and the next 2 bytes will be constantly changing. Tell me how to properly implement such a structure or what to read on this topic. I have never come across this before and I have no idea how to do it.

You can try to create a separate class with getters / setters and call it when initializing the sent array.

  • can send sockets. Socket socket = new Socket("", 8800); InputStream sin = socket.getInputStream(); OutputStream sout = socket.getOutputStream(); byte[] bytes = new byte[8]; sout.write(bytes); Well, in general, read in this direction - JVic
  • @ Victor I set up a transfer between the client and the server. I am interested in the moment of staffing the byte array. As I wrote in the question, there are some bytes changing, some static and written as constants. In occasion of reading in this direction, I did not find anything, most likely I did not google correctly. just do not know in which direction to dig) - ivanovd422

0