Socket write while read is currently blocking
I have a client swing application that is reading from the socket InputStream in its own thread. This is a blocking read, via a BufferedReader.readLine() call.
When someone presses a button or some other event is to trigger a socket write, would you suspect some sort of dead lock or non thread-safe action to take place?
[334 byte] By [
Salamzana] at [2007-11-26 19:51:42]

# 3
> > some sort of dead lock
> If you do your write in the GUI event handler, answer
> is yes.
I've tried this both ways.
1) sendMessage() method, which is called from the GUI event handler, directly calls write and flush on the socket's OutputStream.
2) sendMessage() method, which is called from the GUI event handler, writes to a thread-safe queue, and immedietly returns.
I have no issue with the second option, other than I need a separate outbound thread to dispatch the messages from the queue to the socket's OutputStream.
However, when I try option 1, it works. Are your concerns that it will not always work? Or that it actually shouldn't work, and I'm just geting lucky? Please explain your concerns.
I'm trying to reduce my thread count since this is running on a Mobile unit( i.e. PDA ) and would like to reduce overhead.