Gordon said:
Probably, yes. I thought to add that exact sentiment in my previous
reply, but didn't want to come across as rude!
It sounds odd to me that the existence (or lack) of CR is "random".
Same here. I was told in the spec that the records would be capped with a
Have I understood correctly that your C++ clients work as expected,
and you are now implementing a Java client to an existing C++ server?
NO. The original application which I wrote consisted of a C++ server and
client both of which use unix sockets with no EOR delimiter and they work
fine.
Now I am having to replace this with a server that is provided and has been
written using windows based C++ and I have to write the client. So I have
done this using java.
Do the C++ clients not have any special logic to deal with record
boundaries? Can you not change the way the server sends messages?
As I mentioned earlier, a small timing change could make a difference.
Basically if there is a short delay between calls to write(), it is
often the case that they will be sent separately by TCP. As long as
the recipient reads() sufficiently quickly, he will receive them
separately as well. This can work ("by accident"), but you really
shouldn't rely on this behaviour.
Accepted and thanks for that knowledge.
If the sender sends short messages without delay in between, then TCP
may send them together. Similarly when the reader is slow, messages
will accumulate in his receive buffer, and calls to read() cannot
distinguish between them.
Which appears to be my problem here.
Okay this is the code that I am trying to run
===============================================================================
try
{
while ((running.get()) && (parentProxy.br != null) &&
(parentProxy.br.ready()))
{
try
{
mResponse = "";
if (parentProxy.br != null)
{
mResponse = parentProxy.br.readLine(); // read the response from the m
server
logDebugToFile("TSreader::run processing [" + mResponse + "]");
parentProxy.processMResult(mResponse); // send the result back to the
client
}
}
catch(SocketTimeoutException e)
{
// do nothing here
}
}
}
catch(Throwable e)
{
logFatalToFile("TSreader::run Error (running) " + e.getMessage(), e);
e.printStackTrace();
}
===============================================================================
and this is the output of the code
===============================================================================
27 Oct 2005 09:34:15 GMT: DEBUG - {Thread-0} {Thread-4}
TSreader::run processing [CCOK Q458000:Y:a:XXXX48]
27 Oct 2005 09:34:16 GMT: DEBUG - {Thread-0} {Thread-4}
TSreader::run processing []
27 Oct 2005 09:34:16 GMT: FATAL - {Thread-0} {Thread-4}
TSreader::run Error (running) String index out of range: 6
java.lang.StringIndexOutOfBoundsException: String index out of range: 6
at java.lang.String.charAt(Unknown Source)
at TS.MP.processMResult(MP.java:486)
at TS.TSreader.run(TSreader.java:81)
at java.lang.Thread.run(Unknown Source)
27 Oct 2005 09:34:16 GMT: DEBUG - {Thread-0} {Thread-4}
TSreader::run processing [CCOK E458000:Y:a:XXXX34]
===============================================================================
as can be seen, it can read the first record and the 3rd record but the
second record is coming back empty
Based on this input on the socket (obtained using ethereal)
===============================================================================
CCOK
Q458000:Y:a:XXXX48C\x9f`C\xd8@^@6^@^@^@6^@^@^@^@^N\x83\x9c\x91\xb2^@^K\xdb\x95\xc
(^H^@E^@^@(V\xbf@^@@^F^@^@\xc0\xa8j\xac^]^H^P\x8f
\xbc#\x8d\xf5\x95\xd4\xd3\xd1\x83^G\xfdP^P\xe4
Y^F^@^@C\x9f`C\xdbC^@<^@^@^@<^@^@^@^@^K\xdb\x95\xc
(^@^N\x83\x9c\x91\xb2^H^@E^@^@)^O\xf5@^@}^F\x94\xee^]^H^P\x8f\xc0\xa8j\xac#\x8d\xbc\xd1\x83^G\xfd\xf5\x95\xd4\xd3P^X^^^[Z\x91^@^@^M^@^@^@^@^@C\x9f`C\x8en^@\x87^@^@^@\x87^@^@^@^@^N\x83\x9c\x91\xb2^@^K\xdb\x95\xc
(^H^@E^@^@yV\xc6@^@@^F^@^@\xc0\xa8j\xac^]^H^P\x8f
\xbc#\x8d\xf5\x95\xd4\xd3\xd1\x83^G\xfeP^X\xe4YW^@^@C:MISTER-48/5 :WXYZ :4111111111111111 :0605:
20.00:JTWB801XXXX48 ^MC\x9f`C\xab\x86^@M^@^@^@M^@^@^@^@^K\xdb\x95\xc
(^@^N\x83\x9c\x91\xb2^H^@E^@^@?^P\xf5@^@}^F\x93\xd8^]^H^P\x8f\xc0\xa8j\xac#\x8d
\xbc\xd1\x83^G\xfe\xf5\x95\xd5$P^X^]\xca\x88g^@^@CCOKR458000:Y:a:XXXX10C\x9f`C8\xb7^K^@\x87^@^@^@\x87^@^@^@^@^N\x83\x9c\x91\xb2^@^K\xdb\x95\xc
(^H^@E^@^@yV\xcc@^@@^F^@^@\xc0\xa8j\xac^]^H^P\x8f
\xbc#\x8d\xf5\x95\xd5$\xd1\x83^H^UP^X\xe4
YW^@^@C:MISTER-18/5 :WXYZ :4111111111111111 :0605:
20.00:KTWB801XXXX18 ^MC\x9f`C\xba^K^@O^@^@^@O^@^@^@^@^K\xdb\x95\xc
(^@^N\x83\x9c\x91\xb2^H^@E^@^@A^R\xf5@^@}^F\x91\xd6^]^H^P\x8f\xc0\xa8j\xac#\x8d
\xbc\xd1\x83^H^U\xf5\x95\xd5uP^X^]yE~^@^@^MCCOK
E458000:Y:a:XXXX34^MC\x9f`C^K'^M^@6^@^@^@6^@^@^@^@^N\x83\x9c\x91\xb2^@^K\xdb\x95\xc
(^H^@E^@^@(V\xd1@^@@^F^@^@\xc0\xa8j\xac^]^H^P\x8f
\xbc#\x8d\xf5\x95\xd5u\xd1\x83^H.P^P\xe4Y^F^@^@C\x9f`C\xf3\xdd^M^@M^@^@^@M^@^@^@^@^K\xdb\x95\xc
(^@^N\x83\x9c\x91\xb2^H^@E^@^@?^T\xf5@^@}^F\x8f\xd8^]^H^P\x8f\xc0\xa8j\xac#\x8d
\xbc\xd1\x83^H.\xf5\x95\xd5uP^X^]y\x82F^@^@
===============================================================================
and I am struggling to find out why this is happening
If you can see where I am going wrong then I would greatly appreciate your
advice.
The really annoying thing is that I have written a simulator based on the
servers spec of capping the records with a <CR> and my client can process
up to 100,000 record sin a 2 hour period. So this is really starting to
piss me off!
Cheers,
Pep.