> From: Hespelt, Steve (Exchange) [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 24, 2002 12:59 PM
[re receiving a document from a TCP socket] > I used a callback (the BinInputStream object is the registered > callback object) strategy on the parsing of the top level tag so > when the parser was done seeing the entire XML document, the > callback notified the BinInputStream that there was no more need to > read & that object sets a flag that is checked inside readBytes() > prior to doing a read on the socket (option #2 below). my > readBytes() blocks for a very short time & returns what it has > read. That's a good method too, and solves the problem of having to detect the end of the document inside readBytes(). A slight variation would be to have readBytes() try a non-blocking receive, then if no data was available either do a timed wait on a semaphore controlled by the callback, or (if the platform supports it) block on both the socket and the semaphore. In any case, the key is the callback on parsing the top-level tag. Michael Wojcik Principal Software Systems Developer, Micro Focus Department of English, Miami University --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
