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

  • SEARCH
  • Home
  • 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 7834991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:25:51+00:00 2026-06-02T13:25:51+00:00

My C# .net application currently does the following (among other things): Creates a thread

  • 0

My C# .net application currently does the following (among other things):

  1. Creates a thread which opens a socket on a specific port and waits for an instruction.
  2. Message comes in, socket thread reads the message and raises an event.
  3. An event handler calls the necessary functions to parse the message and performs the necessary action, for instance, launching an application.
  4. The specified external “application” launches, asynchronously.

When my application restarts, but the external application does not close, the socket doesn’t seem to ever close. Then when I try to start up communication on that port again I get an error. However, as soon as I close the external application I am able to open a socket on that port.

It seems like my program is not closing down properly. It should be killing the socket when it exits, however when the external process is running that socket never closes.

Any ideas?

  • 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-02T13:25:55+00:00Added an answer on June 2, 2026 at 1:25 pm

    This is just a stab because I have seen how you’re starting the external process. If you’re creating a Process object, my guess is you’re not setting:

    ProcessStartInfo.UseShellExecute = true;
    

    If UseShellExecute is set to false, the child process will inherit open socket handles from the parent process. This will keep your socket open even if the parent application is closed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a 32-bit .Net application (on x86 Windows) which require lots of
my ASP.NET application reads an xml file to determine which environment it's currently in
For the web application (ASP.NET MVC) I'm currently developing, we have the following architecture
I am currently developing a .NET application, which consists of 20 projects. Some of
We are developing an ASP.NET MVC Application that currently uses it's own database ApplicationData
We are currently building the framework for developing a C# .net application using visual
I want to preserve a property between postbacks in an ASP.Net application. Currently doing
I'm currently debugging an ASP.NET MVC application that was just deployed to a different
I am currently working on a ASP.NET AJAX application. Having decided to not use
I am developing a C#/SQL ASP.NET web application in VS 2008. Currently I am

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.