Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Setting a timeout time for MarshalByRefObject?

Setting a timeout time for MarshalByRefObject?

Scheduled Pinned Locked Moved .NET (Core and Framework)
sysadminquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jeffb42
    wrote on last edited by
    #1

    I have code along the lines of:

    try
    {
    MarshalByRefObject obj = (MarshalByRefObject)RemotingServices.Connect(
    typeof(MyClasss),
    "http://MyServer:8080/MyClass");

    MyClass class = (MyClass)obj;
    class.CallSomeMethod();
    return;
    

    }
    catch
    {
    // don't do anything
    return;
    }

    In the above code, if for whatever reason I can't connect to my server, an exception is thrown, I eat it, and move on. That's all expected. What I'd like to know is: Is it possible to set how long the timeout is before the remote request gives up? If the server is down, it can take a while before the exception is thrown - sometimes a minute, and I'd like to limit it to something low, like 10 seconds. Thanks, Jeff

    M 1 Reply Last reply
    0
    • J jeffb42

      I have code along the lines of:

      try
      {
      MarshalByRefObject obj = (MarshalByRefObject)RemotingServices.Connect(
      typeof(MyClasss),
      "http://MyServer:8080/MyClass");

      MyClass class = (MyClass)obj;
      class.CallSomeMethod();
      return;
      

      }
      catch
      {
      // don't do anything
      return;
      }

      In the above code, if for whatever reason I can't connect to my server, an exception is thrown, I eat it, and move on. That's all expected. What I'd like to know is: Is it possible to set how long the timeout is before the remote request gives up? If the server is down, it can take a while before the exception is thrown - sometimes a minute, and I'd like to limit it to something low, like 10 seconds. Thanks, Jeff

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      The HttpClientChannel Class[^] has a "timeout" configuration property. Channel and Formatter Configuration Properties[^] Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      J 1 Reply Last reply
      0
      • M Mark Salsbery

        The HttpClientChannel Class[^] has a "timeout" configuration property. Channel and Formatter Configuration Properties[^] Mark

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        J Offline
        J Offline
        jeffb42
        wrote on last edited by
        #3

        Thanks! I wasn't evening thinking about HttpClientChannel (and I wasn't aware of the configuration dictionary that's passed in), just MarshalByRefObject. Thanks, Jeff

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups