public virtual void Connect(string user, string password, string token, [CallerMemberName] string caller = "")
        {
            Log("TRYING TO CONNECT - " + caller);
            var status = NetConnector.Status;

            switch (status)
            {
            case NetPeerStatus.NotRunning:
                NetConnector.Start();
                Log("Networking Thread Started");
                break;

            case NetPeerStatus.Starting:
                break;

            case NetPeerStatus.Running:
                break;

            case NetPeerStatus.ShutdownRequested:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            var msg = NetConnector.CreateMessage();

            msg.Write(user);
            msg.Write(password);
            ((ClientTripleDesNetEncryptor)NetEncryptor).EncryptHail(msg, token);
            NetConnector.Connect(_host, _port, msg);
        }
예제 #2
0
        private ICommonNetReceiverWriterForWrite CreateChannel(string host, int port)
        {
            var factory = NetConnector.Connect <ICommonNetReceiverWriterForWrite>(
                new ServerId(host, port), Client.Support.Consts.WcfServiceName,
                new ConnectionTimeoutConfiguration(Consts.OpenTimeout, Consts.SendTimeout));

            return(factory.CreateChannel());
        }
예제 #3
0
 protected SingleConnection(ServerId server, ConnectionConfiguration configuration,
                            ConnectionTimeoutConfiguration timeoutConfiguration)
 {
     Server = server;
     _bPool =
         new StableElementsDynamicConnectionPool <T>(
             NetConnector.Connect <T>(Server, configuration.ServiceName, timeoutConfiguration),
             -1, configuration.MaxElementCount);
 }