The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
[Originally posted by munavar]

I have purchased your online edition. Now I am developing a jabber client.
Presently I'm facing a problem regarding blocking read operation.
How to avoid blocking read operation in jabber client
import-bot (20211) [Avatar] Offline
Re: Regarding jabber client blocking read operation
[Originally posted by iain.shigeoka]

The client code from the book was written against java 1.3 which requires
reads on sockets to block (non-blocking i/o was introduced in Java 1.4). The
typical way to have other parts of the application proceed while the blocking
read is occuring is to do the reading in one thread, an the rest of the
application in another. Data from the read thread is then passed to the
application thread (typically through a queue or list that the application
thread can poll).

You may want to check out Smack which implements this for you (and is designed
to be much easier to use than the book code):