System.Net.Sockets.TcpClient.GetStream C# (CSharp) Method

GetStream() public method

public GetStream ( ) : NetworkStream
return NetworkStream
        public NetworkStream GetStream()
        {
            if (NetEventSource.IsEnabled) NetEventSource.Enter(this);

            if (_cleanedUp)
            {
                throw new ObjectDisposedException(this.GetType().FullName);
            }
            if (!Connected)
            {
                throw new InvalidOperationException(SR.net_notconnected);
            }

            if (_dataStream == null)
            {
                _dataStream = new NetworkStream(Client, true);
            }

            if (NetEventSource.IsEnabled) NetEventSource.Exit(this, _dataStream);
            return _dataStream;
        }

Usage Example

Ejemplo n.º 1
1
        public Player(TcpClient client, string ip, byte id)
        {
            try
            {
                this.username = "******";
                this.plyClient = client;
                this.x = 0;
                this.y = 0;
                this.z = 0;
                this.rotx = 0;
                this.roty = 0;
                this.prefix = "";
                this.id = id;
                this.ip = ip;

                this.world = null;

                this.outQueue = new Queue<Packet>();
                this.blockQueue = new Queue<Packet>();
                this.IOThread = new Thread(PlayerIO);
                this.outputWriter = new BinaryWriter(client.GetStream());
                this.inputReader = new BinaryReader(client.GetStream());

                this.IOThread.IsBackground = true;
                this.IOThread.Start();
            }
            catch
            {
            }
        }
All Usage Examples Of System.Net.Sockets.TcpClient::GetStream