Terminating a socket listener thread in a loop

  • Thread starter Thread starter eliss.carmine
  • Start date Start date
E

eliss.carmine

Hi, I have an application where a listener thread has a while loop that
just calls Socket.ReceiveFrom over and over. When I close the app by
clickin on the X, the process doesn't die because there is still this
listener thread running. How do I terminate this thread as well?

Thanks
 
if all you want is to aboart the thread when the application terminates call
..Abort() method on the thread.
This will raise an exception on your thread causing it to exit the loop

Fitim Skenderi
 
Hello, (e-mail address removed)!


you have to call Socket.Close() on receiveing socket and handle
SocketExeption exceptions that may be thrown
on Socket.ReceiveFrom(...)

ec> Hi, I have an application where a listener thread has a while loop
ec> that
ec> just calls Socket.ReceiveFrom over and over. When I close the app by
ec> clickin on the X, the process doesn't die because there is still
ec> this
ec> listener thread running. How do I terminate this thread as well?

ec> Thanks


--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top