I don't think that you want to do that, even if it works. When you have a
problem that is caused by you leaving some resources, a thread in this case,
allocated, the right fix is to deallocate them, not to find a bigger hammer
to exit the process with.
Paul T.
"Robert Jordan" <(E-Mail Removed)> wrote in message
news:d5opa2$ab0$01$(E-Mail Removed)...
> Mike wrote:
>
>> I've seen a bit of traffic in this group about similar problems but am
>> not quite sure if this is the same. I have an app that needs to read
>> asynchronous data over a socket forever, handling it as it comes in.
>> The app needs to continue to perform other tasks based on user input.
>>
>> So, I create a socket, connect it to my serving app (running on the
>> same device) and call BeginRecieve. All is working as expected except
>> that when I call Application.Exit(), the application does not exit.
>> I've tried calling Shutdown() on the socket, but this did not help.
>
> You may try ExitProcess:
>
> [System.Runtime.InteropServices.DllImport("coredll.dll")]
> public static extern void ExitProcess(uint uExitCode);
>
> Rob
|