I am using StreamReader as the basis for an IRC client I am writing. StreamReader is used within a while...loop and listens (on a thread) for the IRC server to send something.
I have verified via mIRC what will be send from the server during a normal command sequence. However, I have found that the last few lines are not coming through the StreamReader in my program. Further, while debugging my program, if I stop execution, I will find that I loose even more lines.
What I think is happening is that I have to do some processing for each line that comes in via the StreamReader. I think I am taking too long to do the processing and the server is sending more data than I am processing.
1) Is StreamReader the best way to get data from an IRC server?
2) Does StreamReader buffer the data (and I should not worry about my processing slowing it down)?
3) Is there a way to buffer the input via StreamReader or some other method?
The basic code is as follows:
public void thread_runner()
while ( (inputLine = reader.ReadLine () ) != null )
// Determine what kind of message was received
if (inputLine.IndexOf("JOIN") != -1)
// more statements like this follow
If I find that the inputline contains a string I need to process, I fire an event and let this thread continue on. The main GUI thead does the heavy lifting.