I have 2 buttons,1 for reading and 1 for writing, how do I make a key to changed interest op to read or write if a button is pressed?
Asked
Active
Viewed 49 times
1 Answers
0
You 'make a key' by registering a SelectableChannel
with a Selector
, but the rest of your question doesn't make sense. A SelectableChannel
becomes ready for reading when data arrives, and it is almost always ready for writing except when its send buffer is full (i.e. a prior write has returned zero). Neither event can be initiated by a GUI button. If you want your application to send, it should just send, and it should always be reading.

user207421
- 305,947
- 44
- 307
- 483