I suppose you read the data in a blocking manner, right?
Or in which thread do you read data / send messages?
That the sleep does the trick is a indicator, that
you may suffer a concurrency problem. This is kinda hard
to debug remotely.
What you should do is: use a thread to read data
and dispatch the message sending to the ariba main thread
(typical asynchronous design pattern). Then you might get
the problem, that you indeed can't reuse the buffer, because
the message only copies the buffer on serialization depending
on your message's implementation.
You may also check if the memory is valid via valgrind
or similar. Usually the message is copied on each layer
(not optimal, but works *g*) therefore you may re-use
the buffer.
Hope this helps.
Best regards,
Sebastian Mies
--
Sebastian Mies
Gebhardstraße 25
76137 Karlsruhe
Telefon: +49 721 9119627
E-Mail: mi...@gtfr.de