Exemple #1
0
        /// <summary>
        /// Initializes a new instace of 'SNetTcpClient' in server mode.
        /// </summary>
        /// <param name="Socket">The connected socket which data will be read from and written to</param>
        public SNetTcpClient(TcpClient ConnectedSocket)
        {
            if (!ConnectedSocket.IsValid())
            { throw new ArgumentNullException("ConnectedSocket", "'ConnectedSocket' cannot be null"); }

            if (!ConnectedSocket.Connected)
            { throw new ArgumentException("'ConnectedSocket' must be a connected socket", "ConnectedSocket"); }

            Config = new SocketConfig();
            PacketAnalyzer = new PacketReader();

            PacketAnalyzer.OnPacketCompleted += InternalOnPacketCompleted;
            PacketAnalyzer.OnPartialPacketCompleted += InternalOnPartialPacketCompleted;

            Socket = ConnectedSocket;
            InitializeAsynchRecieve(new AsynchRecieveObject());
        }