Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Directory Watch feature and Socket Server  RSS feed

Ranch Hand
Posts: 417
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darrel, thanks for your recent response on that other question on Swing GUI and the nio directory watch feature.

I'm still not clear if I want a Swing GUI or a console mode program. Let's assume I want a console mode program.

Can I write a single threaded console mode program that blocks simultaneously for
(1) directory changes
(2) Socket clients trying to connect to our listen socket
(3) socket clients sending or receiving data?
(4) key strokes from keyboard?

If not, what threads have to be created? Do I need separate threads for the listen socket, one thread for each data socket client, another thread for directory changes and yet another thread for keyboard listener?

I know how to do this with a single main thread with *nix/C++ with the select function and with c++/windows you have spawn a child thread to listen for keystrokes.

I like groovy. I think the code for java and groovy would be almost identical?

I don't think I need multiple threads for performance. I just need to accommodate the APIs.

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!