public ObjServer(
     string url
     , Func <string, IPersistentConnectionServer> serverFactory
     , SerializationConfig sconfig)
 {
     _SerConfig = sconfig;
     _Server    = serverFactory(url);
     _Server.StartListening();
 }
        public SerializationConfig Clone()
        {
            var cloned = new SerializationConfig()
            {
                SplitterFactory = SplitterFactory, Composer = Composer, ReaderWriter = ReaderWriter
            };

            cloned.PostProcessors.AddRange(PostProcessors);
            return(cloned);
        }
 public ObjClient(
     string url
     , Func <string, IPersistentConnection> clientFactory
     , SerializationConfig sconfig)
 {
     _SerConfig = sconfig;
     _Client    = clientFactory(url);
     _Stream    = new ConnectionStream(_Client);
     _Splitter  = sconfig.SplitterFactory(_Stream);
     _Splitter.OnReceiveBlock += OnReceiveBlock;
     _Client.StartConnect();
     _LastReceiveTick = System.Environment.TickCount;
 }
 protected virtual void Dispose(bool disposing)
 {
     if (!disposedValue)
     {
         if (_Server is IDisposable)
         {
             ((IDisposable)_Server).Dispose();
         }
         _Server       = null;
         _SerConfig    = null;
         disposedValue = true;
     }
 }
        public static ObjClient GetClient(string url, SerializationConfig sconfig)
        {
            var uri    = new Uri(url);
            var scheme = uri.Scheme;
            PersistentConnectionCreator creator;

            if (Creators.TryGetValue(scheme, out creator))
            {
                if (creator.ClientCreator != null)
                {
                    return(new ObjClient(url, creator.ClientCreator, sconfig));
                }
            }
            return(null);
        }
 protected virtual void Dispose(bool disposing)
 {
     if (!disposedValue)
     {
         if (!LeaveOpen)
         {
             _Stream.Dispose();
         }
         _Client = null;
         _Stream = null;
         if (_Splitter != null)
         {
             _Splitter.Dispose();
             _Splitter = null;
         }
         _SerConfig       = null;
         _PendingRead.Obj = null;
         disposedValue    = true;
     }
 }