添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
直爽的马克杯  ·  乐享运动 ...·  1 月前    · 
豪爽的饭盒  ·  陕西省教育考试院 ...·  7 月前    · 
挂过科的香菜  ·  Developer Community·  9 月前    · 
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • *Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
    I have this situation:

    1) There is a server on machine S which exposes type T through .NET remoting.
    2) There is a client on another machine C which attempts to remotely instantiate the type T on machine S using Activator.GetObject method.

    If the S machine is running but the server application (which exposes type T) isn't running, you will get an System.Net.Sockets.SocketException with ErrorCode set to 10061 meaning "No connection could be made because the target machine actively refused it."

    If the S machine itself is NOT running you will get an System.Net.Sockets.SocketException with ErrorCode set to 10060 meaning "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.", but after an unreasonable (in my opinion) long timeout.

    How can I control this timeout? (Within the client applications, of course )

    10x.

    RE: Controlling the timeout

    Use asynchronous calls: BeginConnect() with AsyncCallback
    delegate.
    That delegate will try to connect to the remote machine  and then signals the application thread that the connection is complete by using a global ManualResetEvent object (calling WaitOne()).
    Use the same pattern for "send" and "receive" e.g. BeginSend() and BeginReceive().
    -obislavu-

    RE: Controlling the timeout

    Actually, what I needed was to shorten the timeout, and I finally got an answer which is:

    "The TcpChannel doesn't use any timeout at all and also doesn't even allow any timeouts to be set.

    For the HttpChannel, things are a little bit different. There's no default timeout, but you can set one using code like the following:

    SomeObject obj = Activator.GetObject(typeof(SomeObject)," http://somewhere/some.rem ";);
    IDictionary dict = ChannelServices.GetChannelSinkProperties(obj);
    dict["timeout"] = 10;

    Best regards,
    Ingo Rammer
    Author of "Advanced .NET Remoting"
    and "Advanced .NET Remoting in VB .NET"

    Red Flag This Post

    Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

    Red Flag Submitted

    Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
    The Tek-Tips staff will check this out and take appropriate action.

    Reply To This Thread

    Posting in the Tek-Tips forums is a member-only feature.

    Click Here to join Tek-Tips and talk with other members! Already a Member? Login

    Join Tek-Tips ® Today!

    Join your peers on the Internet's largest technical computer professional community.
    It's easy to join and it's free.

    Here's Why Members Love Tek-Tips Forums:

  • Tek-Tips Forums Talk To Other Members
  • Notification Of Responses To Questions
  • Favorite Forums One Click Access
  • Keyword Search Of All Posts, And More...
  • Register now while it's still free!

    Already a member? Close this window and log in.