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. How to signal an app GUI from a .NET server

How to signal an app GUI from a .NET server

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpsysadminjsontutorialannouncement
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.
  • D Offline
    D Offline
    Dave Midgley
    wrote on last edited by
    #1

    I have an application that acts as a remoting server. The app has a front end with lots of controls, and the remoting is (as it must be) a class in a class library of its own, which is instantiated by the remoting system when a call is made by a remote client (as I understand it). I want to be able to update stuff on the screen when a remote client calls a method in the server, but I can't work out how to communicate between the server object and the rest of the application. Can anyone tell me if this is possible and how it's done. Dave

    S 1 Reply Last reply
    0
    • D Dave Midgley

      I have an application that acts as a remoting server. The app has a front end with lots of controls, and the remoting is (as it must be) a class in a class library of its own, which is instantiated by the remoting system when a call is made by a remote client (as I understand it). I want to be able to update stuff on the screen when a remote client calls a method in the server, but I can't work out how to communicate between the server object and the rest of the application. Can anyone tell me if this is possible and how it's done. Dave

      S Offline
      S Offline
      S Senthil Kumar
      wrote on last edited by
      #2

      When you setup the remoting on the server side, instead of allowing the remoting infrastructure to create server objects, create them yourself and register it using RemotingServices.Marshal[^]. You could then expose events from those objects and subscribe to them from the GUI. Something like

      class RObject: MarhsalByRefObject
      {
      event SomethingChangedDelegate SomethingChanged;

      public void RemoteMethod()
      {
      SomethingChanged();
      }
      }
      }

      class GUI
      {
      void RegisterRemoteObjects()
      {
      RObject o = new RObject();
      o.SomethingChanged += ...
      RemotingServices.Marshal(...);
      }
      }

      Regards Senthil _____________________________ My Blog | My Articles | WinMacro

      D 1 Reply Last reply
      0
      • S S Senthil Kumar

        When you setup the remoting on the server side, instead of allowing the remoting infrastructure to create server objects, create them yourself and register it using RemotingServices.Marshal[^]. You could then expose events from those objects and subscribe to them from the GUI. Something like

        class RObject: MarhsalByRefObject
        {
        event SomethingChangedDelegate SomethingChanged;

        public void RemoteMethod()
        {
        SomethingChanged();
        }
        }
        }

        class GUI
        {
        void RegisterRemoteObjects()
        {
        RObject o = new RObject();
        o.SomethingChanged += ...
        RemotingServices.Marshal(...);
        }
        }

        Regards Senthil _____________________________ My Blog | My Articles | WinMacro

        D Offline
        D Offline
        Dave Midgley
        wrote on last edited by
        #3

        Thanks Senthil. I eventually found a viable solution by getting the server class to post windows messages to the GUI. However, yours is an interesting alternative which I shall investigate. I need to understand some of these more advanced remoting techniques. Thanks. Dave

        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