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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to interrupt a thread waiting for client connection? (URGENT)

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,
The main thread of server sets the status to IDLE and then it starts another thread (child thread). Now the main thread is waiting for client connection (by calling Socket.accept()method).
In the mean time, the child thread sets the server status to STOPPING due to the request it received.
Now the server main thread should not continue waiting for the client connection if the status had been set to STOPPING.
Is there any way to make the server thread to come out of the blocking state (i.e, it usually blocks until it accepts a connection and it should come out of it).
Is there any way for the server thread to check for the status while it is blocking for a client connection?
Thanks in advance...
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I already answered this question in Sockets and Internet Protocols. Please don't crosspost; people will waste their time giving duplicate answers. Thanks.
- Peter
[This message has been edited by Peter den Haan (edited November 12, 2001).]
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic