M
Mack Attack
I'm writing a Java client that connects to a C Server. The C server has a
struct like this:
typedef struct {
TEXT name[8],
name1[8],
reg
;
}mystruct;
TEXT is a char.
When I read this from the server, it's sending me 17 bytes as I expected.
Everything works fine that way. The problem is when I send the 17 bytes back
to the server. The fields are set with the correct values but the strings are
no longer null terminated.
So for example, if I sent name = "whatever" and name1 = "somethin" and
reg = null to the server then when I check the value of name on the server it
gives me "whateversomthin". Everything up to the null terminator.
Is there any way to fix this problem? I can't rewrite the server so I have to
figure out something on the Java client.
Thanks,
Mack
struct like this:
typedef struct {
TEXT name[8],
name1[8],
reg
;
}mystruct;
TEXT is a char.
When I read this from the server, it's sending me 17 bytes as I expected.
Everything works fine that way. The problem is when I send the 17 bytes back
to the server. The fields are set with the correct values but the strings are
no longer null terminated.
So for example, if I sent name = "whatever" and name1 = "somethin" and
reg = null to the server then when I check the value of name on the server it
gives me "whateversomthin". Everything up to the null terminator.
Is there any way to fix this problem? I can't rewrite the server so I have to
figure out something on the Java client.
Thanks,
Mack