Re: Killing a thread started with delegate.BeginInvoke()

From: Alvin Bruney [MVP] (vapor)
Date: 02/10/05


Date: Thu, 10 Feb 2005 14:07:00 -0400

Why arenm't you keeping remote connections open? Would it not be more
efficient to open the connection only when it is needed? Modify your
connection string to force connection pooling to be on (i think it is off
for remote configurations) if object creating is particularly expensive.
With this design, you wouldn't need to kill threads.

-- 
Regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://www.lulu.com/owc
----------------------------------------------------------
"Jako Menkveld" <jako.menkveld@envalue.ch> wrote in message 
news:OTps5$1DFHA.2232@TK2MSFTNGP14.phx.gbl...
> Sadhu / Sunny
>
> Thanks for your replies.
>
> OK, I'll have a go at explaining this:
>
> I have a server exposing a remote object (on TCP).  Then I have clients 
> which connects to the server and calls methods on the remote object as 
> random interval.  For performance reasons, I don't break and re-establish 
> the connection everytime, I keep a reference to the remote object and just 
> keep calling it's methods whenever I need them.
>
> This sounds like a simple scenario, but the problem comes in when the 
> server shuts down (this can happen in my implementation and I need to 
> cater for this).
>
> I mentioned in an post to this newsgroup that I have a problem "killing" 
> the TCP connection when the server shutsdown.  This is because the clients 
> still have their side of the connection and for some reason the OS takes 
> over control of the listening port. (see my post: How to "kill" a tcp 
> port, posted 31/01/2005).
>
> When the client then tries to call a method on the server, it just hangs 
> without throwing an exception, which means I have to kill the process 
> using Task Manager.
>
> To overcome this problem I use an asynchronous delegate to call the method 
> and wait a specified time for the method to return, if it doesn't, I treat 
> it as if the server has been shutdown.  What I'm left with after that is 
> the asynchronous delegate's thread which I want to kill.
>
> I hope this makes it a bit clearer.
>
> Cheers
> Jako
>
>
> "Sunny" <sunny@newsgroup.nospam> wrote in message 
> news:uYs937rDFHA.628@TK2MSFTNGP15.phx.gbl...
>> In article <emx2B2eDFHA.208@TK2MSFTNGP12.phx.gbl>,
>> jako.menkveld@envalue.ch says...
>>> Is this at all possible?
>>>
>>>
>>>
>>
>> Not directly. As sadhu said, they are from the thread pool, so they are
>> managed by the framework.
>>
>> But if you provide more information about what you want to achieve,
>> maybe someone can come up with workaround.
>>
>> Sunny
>
> 


Relevant Pages

  • Re: Remote Access and ISA Server in SBS 2003?
    ... I am glad to hear the Remote Access Wizard is working fine now. ... there is no difference in VPN between SBS 4.5 and SBS ... Error Message: VPN Connection Error 800: Unable to Establish Connection ... the external NIC of the SBS Server. ...
    (microsoft.public.windows.server.sbs)
  • RE: Another Remote Connection Manager Problem
    ... > internal and 192.168.1.3 for the internet connection. ... > via the SBS server to all clients. ... > With this configuration OWA and Remote Workplace are operational. ... > Connection Manager to connect to the VPN server and gain access to a shared ...
    (microsoft.public.windows.server.sbs)
  • Re: Another Remote Connection Manager Problem
    ... > internal and 192.168.1.3 for the internet connection. ... > via the SBS server to all clients. ... > With this configuration OWA and Remote Workplace are operational. ...
    (microsoft.public.windows.server.sbs)
  • Re: Killing a thread started with delegate.BeginInvoke()
    ... connection string to force connection pooling to be on (i think it is off ... for remote configurations) if object creating is particularly expensive. ... you wouldn't need to kill threads. ... > I have a server exposing a remote object. ...
    (microsoft.public.dotnet.framework)
  • Re: Connecting a remote workstation to a domain
    ... If you have more than a couple of remote workstations connecting to the SBS ... server via VPN, you really need to consider a Terminal Server in the main ... "Log in using a dial up connection" checkbox, ... roaming profile then synchronizes with the server over the VPN); ...
    (microsoft.public.windows.server.sbs)