I am trying to make a tcp request in Java to a existing TCP server that is already available. the interface specification is:
Field Length Type
Length 2 bytes 16-bits binary
Message ID 1 byte 8-bits binary
MSGTYPE 1 byte 8-bits binary
Variable1 4 bytes 32-bits binary
Variable2 30 bytes ASCII
Variable3 1 byte 8-bits binary
I understand how to convert a String to Binary using BigInteger.
String testing = "Test Binary";
byte[] bytes = testing.getBytes();
BigInteger bi = new BigInteger(bytes);
System.out.println(bi.toString(2));
My Understanding is that if i wanted to make a TCP request i would first
- need to convert each binary to a string
- append the values to a StringBuffer.
Unfortunately my understanding is limited so i wanted some advice on creating the TCP request correctly.