[Spread-users] Re: MAX_PRIVATE_NAME int to byte? and Java API bug

christian.wohanka at systemagmbh.de christian.wohanka at systemagmbh.de
Mon Nov 18 10:07:56 EST 2002


Hello again,

I solved the problem to push MAX_PRIVATE_NAME up to 255 (and above)
characters. I compiled a version, able to take full advantage of an int32
value
for the length of the private name. Therefore I made some changes in
session.c,
sp.c, groups.c, sp.h, spread_params.h and the JAVA-API (by the way, there
is a bug in in SpreadConnection.java at line 1039,
fix: byte header[] = new byte[(MAX_GROUP_NAME+16)];)
It was a little bit tricky, because the often used
len=sizeof(message_header).
The returned value fits not always to read from a socket due to the
length of the char array in a message_header. I assume it would be much
better to compute the length like this len=(MAX_GROUP_NAME+sizeof(int32u)+
sizeof(int32)+sizeof(int32)+sizeof(int32)) to read an amount len from the
socket.

I tested it roughly with private names up to 255 characters and 500 client
connections per deamon and the whole thing seems to work very
well with the C-API as well as the JAVA-API.

Bye !

Christian


> Hello list,
>
> I tried to push MAX_PRIVATE_NAME in spread_params.h, sp.h and the
> JAVA API to 255 characters.
> After compiling, a small JAVA test application is no more able to connect
> to the deamon in a right way. I found out, that the int len value of the
> private name is pressed into a byte field, it seems that's the problem.
> This is also the same in sp.c (conn[4] = len;).
>
> If I change the procedure in sp.c to gather 4 bytes for the len (conn[4]
-
> conn[7]) sptuser seems to work. I changed the JAVA API also to work
> with 4 bytes for the length, but the connect fails in the
> private void checkAccept() throws SpreadException method when
> it tries to read from the input socket.
>
> I use Spread 3.17.0 with WIN NT4.
>
> Now my questions:
>
> Why is the int len value cast to a byte?
> Which methods in the deamon handle the incoming data from the
> sockets of the JAVA API?
> What (in general) must I change in the deamon to get the full use of the
> len value?
>
> Thanks in advance!
>
> Christian






More information about the Spread-users mailing list