Click here to Skip to main content
15,908,013 members
Home / Discussions / C#
   

C#

 
GeneralBufferedStream & StreamReader Pin
Katalyst29-Apr-03 14:10
Katalyst29-Apr-03 14:10 
I have some code that reads from a NetworkStream, retrieving both standard strings as well as binary data. The following code works:

connection_ = new TcpClient(host, port);
connection_.ReceiveTimeout = 30000;
			
stream_ = connection_.GetStream();
bufStream_ = new BufferedStream(stream_);

reader_ = new StreamReader(stream_, Encoding.GetEncoding("iso-8859-1"));

string str = reader_.ReadLine();

byte b = (byte)bufStream_.ReadByte();


But it's a little weird because the reader goes directly against the network stream for reading full lines as strings, but it goes through the buffered stream when reading individual bytes. Even though this works, I tried the following change:

reader_ = new StreamReader(bufStream_, Encoding.GetEncoding("iso-8859-1"));


But this doesn't work at all. When it gets to the ReadLine, it blocks indefinitely. Could this be a bug in BufferedStream? I'm using .Net 1.0, by the way.
GeneralRe: BufferedStream & StreamReader Pin
Katalyst29-Apr-03 15:59
Katalyst29-Apr-03 15:59 
GeneralWindows Forms events Pin
Arun Bhalla29-Apr-03 13:57
Arun Bhalla29-Apr-03 13:57 
GeneralRe: Windows Forms events Pin
Martin Cook29-Apr-03 16:53
professionalMartin Cook29-Apr-03 16:53 
GeneralGet strings from IntPtr Pin
Anonymous29-Apr-03 10:40
Anonymous29-Apr-03 10:40 
GeneralRe: Get strings from IntPtr Pin
Stephane Rodriguez.29-Apr-03 10:58
Stephane Rodriguez.29-Apr-03 10:58 
GeneralResourceManager.GetObject Pin
J. Dunlap29-Apr-03 10:28
J. Dunlap29-Apr-03 10:28 
GeneralExecuting an .exe file on server trough ASP.NET as Administrator Pin
Jonas Follesø29-Apr-03 10:06
Jonas Follesø29-Apr-03 10:06 
GeneralRe: Executing an .exe file on server trough ASP.NET as Administrator Pin
Stephane Rodriguez.29-Apr-03 11:08
Stephane Rodriguez.29-Apr-03 11:08 
GeneralRe: Executing an .exe file on server trough ASP.NET as Administrator Pin
Jonas Follesø29-Apr-03 12:04
Jonas Follesø29-Apr-03 12:04 
GeneralRe: Executing an .exe file on server trough ASP.NET as Administrator Pin
Ray Cassick29-Apr-03 11:17
Ray Cassick29-Apr-03 11:17 
GeneralRe: Executing an .exe file on server trough ASP.NET as Administrator Pin
Jonas Follesø29-Apr-03 12:06
Jonas Follesø29-Apr-03 12:06 
GeneralRe: Dirty solution... Pin
Jonas Follesø29-Apr-03 23:14
Jonas Follesø29-Apr-03 23:14 
Generalsaving to an evironment var Pin
monrobot1329-Apr-03 8:27
monrobot1329-Apr-03 8:27 
GeneralRe: saving to an evironment var Pin
Stephane Rodriguez.29-Apr-03 11:06
Stephane Rodriguez.29-Apr-03 11:06 
GeneralRe: saving to an evironment var Pin
monrobot1330-Apr-03 2:54
monrobot1330-Apr-03 2:54 
Generalsource draw Pin
tuan_tomy29-Apr-03 7:08
tuan_tomy29-Apr-03 7:08 
GeneralRe: source draw Pin
Stephane Rodriguez.29-Apr-03 11:11
Stephane Rodriguez.29-Apr-03 11:11 
QuestionChange local hostname using WMI? Pin
KevinS7529-Apr-03 6:24
KevinS7529-Apr-03 6:24 
GeneralPlain text in a RichTextBox Pin
monrobot1329-Apr-03 5:34
monrobot1329-Apr-03 5:34 
GeneralRe: Plain text in a RichTextBox Pin
monrobot1329-Apr-03 5:52
monrobot1329-Apr-03 5:52 
GeneralDataGrid Pin
Rick Crone29-Apr-03 4:48
Rick Crone29-Apr-03 4:48 
GeneralRe: DataGrid Pin
Burt Harris4-May-03 16:47
Burt Harris4-May-03 16:47 
GeneralRe: DataGrid Pin
Rick Crone7-May-03 4:45
Rick Crone7-May-03 4:45 
GeneralDataTable and SQL Queries Pin
zoltan_ie29-Apr-03 1:53
zoltan_ie29-Apr-03 1:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.