PipBoy.PipBoyStreamProvider.Connect C# (CSharp) Method

Connect() public method

public Connect ( string host, int port ) : Stream
host string
port int
return Stream
        public Stream Connect(string host, int port)
        {
            _tcpClient = new TcpClient();
            _tcpClient.Connect(host, port);
            Stream stream = _tcpClient.GetStream();
            if (_rawDumpFile != null)
            {
                stream = new CopyInputStream(stream, new FileStream(_rawDumpFile, FileMode.Create), true);
            }
            return ProcessStream(stream, true);
        }

Usage Example

Example #1
0
        static void Main(string[] args)
        {
            using (var streamProvider = new PipBoyStreamProvider(DebugSettings.DumpTcpStream ? DebugSettings.TcpDumpFile : null))
            {
                var stream = DebugSettings.UseTcp
                    ? streamProvider.Connect(DebugSettings.Host, DebugSettings.Port)
                    : streamProvider.ReadFile(DebugSettings.InputFile);

                using (stream)
                {
                    ReadStream(stream);
                }
            }

            if (Debugger.IsAttached)
            {
                Console.WriteLine("finished");
                Console.ReadLine();
            }
        }
All Usage Examples Of PipBoy.PipBoyStreamProvider::Connect