Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8494243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:14:49+00:00 2026-06-10T23:14:49+00:00

I am building a simple wpf application. The gui has a button, that when

  • 0

I am building a simple wpf application. The gui has a button, that when pressed will
create a background thread. A websocket server will run on this background thread. The
websocket server is event driven. There may be periods of low activity on this server,
but I don’t want the thread to terminate due to low volume. Is there a simple way to make
this thread persistent (at least until the app terminates)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:14:50+00:00Added an answer on June 10, 2026 at 11:14 pm

    Why would the thread terminate due to low volume? The thread will only terminate when you tell it to. Even if your application and form are closed the background thread will most likely still run.

    I have something similar with a TCPServer class (which uses a TCPListener) in a thread, and since the background thread can be blocked in a AcceptTcpClient() (which is blocking and in an infinite loop), the TCPListener has to be closed manually:

    public partial class MainForm : Form
    {
        public TCPServer TCPServer = new TCPServer();
        private Thread ServerThread = null;
    
        private void button1_Click(object sender, EventArgs e)
        {
            ServerThread = new Thread(TCPServer.Run);
            ServerThread.Start();
        }
    
        private void OnApplicationExit(object sender, EventArgs e)
        {
            if (TCPServer.Server != null)
                TCPServer.Server.Stop();
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building simple dictionary application using WPF. I'm using MVVM pattern, databinding and FlowDocument
I'm currently tasked with building a spreadsheet-like GUI for a WPF application and I've
I am building a simple WPF application. I have a transparent maximized Window and
I am building a WPF application that monitors a directory on the users computer.
I am building a simple echo server for the purposes of learning the fundamentals
I'm building a simple web application in tornado.web using mongodb as the backend. 90%
I’m building a WPF application using MVVM pattern (both are new technologies for me).
I'm building simple application on as3. Kind of starship game. What I want to
I am building a simple Calculator application. I'm also learning how to apply the
I'm building a single window WPF application In the window is a list items

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.