Exemple #1
0
        /// <summary>
        /// Creates a new connection for processing data
        /// </summary>
        public Connection(Socket client, bool _IsServer, VaserOptions Mode, PortalCollection PColl, VaserKerberosServer KerberosS, VaserSSLServer SSLS, VaserKerberosClient KerberosC, VaserSSLClient SSLC, VaserServer srv = null)
        {
            IsServer          = _IsServer;
            StreamIsConnected = true;

            _rms2 = new MemoryStream();
            _rbr2 = new BinaryReader(_rms2);


            _Mode        = Mode;
            _PCollection = PColl;

            _vSSLS      = SSLS;
            _vKerberosS = KerberosS;
            _vSSLC      = SSLC;
            _vKerberosC = KerberosC;

            _SocketTCPClient             = client;
            _SocketTCPClient.LingerState = new LingerOption(true, 0);

            server = srv;

            IPv4Address = ((IPEndPoint)client.RemoteEndPoint).Address;

            link = new Link(PColl)
            {
                Connect = this
            };
            if (Mode == VaserOptions.ModeNotEncrypted)
            {
                mySendNotEncryptedCallback    = new AsyncCallback(SendNotEncryptedCallback);
                myReceiveNotEncryptedCallback = new AsyncCallback(ReceiveNotEncryptedCallback);
            }
            if (Mode == VaserOptions.ModeKerberos)
            {
                mySendKerberosCallback    = new AsyncCallback(SendKerberosCallback);
                myReceiveKerberosCallback = new AsyncCallback(ReceiveKerberosCallback);
            }

            if (Mode == VaserOptions.ModeSSL)
            {
                mySendSSLCallback    = new AsyncCallback(SendSSLCallback);
                myReceiveSSLCallback = new AsyncCallback(ReceiveSSLCallback);
            }
            if (_IsServer)
            {
                ThreadPool.QueueUserWorkItem(HandleClientComm);
            }
            else
            {
                HandleClientComm(null);
            }
        }
Exemple #2
0
        /// <summary>
        /// Creates a new connection for processing data
        /// </summary>
        public Connection(StreamSocket client, bool _IsServer, VaserOptions Mode, PortalCollection PColl, VaserKerberosServer KerberosS, VaserSSLServer SSLS, VaserKerberosClient KerberosC, VaserSSLClient SSLC, VaserServer srv = null)
        {
            IsServer          = _IsServer;
            StreamIsConnected = true;

            _rms2 = new MemoryStream();
            _rbr2 = new BinaryReader(_rms2);


            _Mode        = Mode;
            _PCollection = PColl;

            _vSSLS      = SSLS;
            _vKerberosS = KerberosS;
            _vSSLC      = SSLC;
            _vKerberosC = KerberosC;

            _SocketTCPClient = client;

            server = srv;
            //Debug.WriteLine("Init Options Done");
            IPv4Address = client.Information.RemoteAddress;

            link = new Link(PColl)
            {
                Connect = this
            };
            //Debug.WriteLine("Create Link Done");

            //Debug.WriteLine("Init Connection class DONE");
            if (_IsServer)
            {
                //Debug.WriteLine("Send to HandleClientComm");
                IAsyncAction asyncAction = ThreadPool.RunAsync(HandleClientComm);
            }
            else
            {
                HandleClientComm(null);
            }
        }
Exemple #3
0
        /// <summary>
        /// Creates a new connection for processing data
        /// </summary>
        public Connection(Socket client, bool _IsServer, VaserOptions Mode, PortalCollection PColl, VaserKerberosServer KerberosS, VaserSSLServer SSLS, VaserKerberosClient KerberosC, VaserSSLClient SSLC, VaserServer srv = null)
        {
            IsServer          = _IsServer;
            StreamIsConnected = true;


            _rms2 = new MemoryStream();
            _rbr2 = new BinaryReader(_rms2);



            _Mode        = Mode;
            _PCollection = PColl;

            _vSSLS      = SSLS;
            _vKerberosS = KerberosS;
            _vSSLC      = SSLC;
            _vKerberosC = KerberosC;

            client.SendBufferSize = 65007;
            _SocketTCPClient      = client;

            server = srv;

            IPv4Address = ((IPEndPoint)client.RemoteEndPoint).Address;

            link         = new Link(PColl);
            link.Connect = this;

            if (_IsServer)
            {
                ThreadPool.QueueUserWorkItem(HandleClientComm);
            }
            else
            {
                HandleClientComm(null);
            }
        }