Example #1
0
        /// <summary>
        /// Initializes this object.
        /// </summary>
        public WatchdogHost()
        {
            _watchdog = new InternalWatchdog();

            _endPoint = new SocketEndPoint(EndPointType.Server, PeerName);
            _endPoint.CreateServant(ObjectId, (IInternalWatchdog)_watchdog);
            _endPoint.Bind(IPAddress.Any);
        }
Example #2
0
        /// <summary>
        /// Initializes a new silo that hosts all objects in the same process it is used in, but with
        /// proxy and servant implementations in between.
        /// Is only really useful for debugging remoting.
        /// </summary>
        /// <param name="customTypeResolver">The type resolver, if any, that is used to resolve types by their assembly qualified name</param>
        public InProcessRemotingSilo(ITypeResolver customTypeResolver = null)
        {
            _customTypeResolver = customTypeResolver;
            const int subjectHostId = 0;

            _nextObjectId = subjectHostId + 1;

            _client           = new SocketEndPoint(EndPointType.Client);
            _subjectHostProxy = _client.CreateProxy <ISubjectHost>(subjectHostId);

            _syncRoot = new object();

            _server      = new SocketEndPoint(EndPointType.Server);
            _registry    = new DefaultImplementationRegistry();
            _subjectHost = new SubjectHost(_server, _registry);
            _server.CreateServant(subjectHostId, (ISubjectHost)_subjectHost);
            _server.Bind(IPAddress.Loopback);

            _client.Connect(_server.LocalEndPoint, TimeSpan.FromSeconds(5));
        }
Example #3
0
 public void RegisterSubjectWith(ISocketEndPoint endPoint)
 {
     endPoint.CreateServant(_objectId, _subject);
 }
Example #4
0
 /// <inheritdoc />
 public IServant CreateServant <T>(ulong objectId, T subject) where T : class
 {
     return(_endPoint.CreateServant(objectId, subject));
 }