Retriving data from a irc server
-
Hello. I have been creating a simple irc client that connects to a server and sends some simple commands to it I have also figured out how to retrive data from the server by using streams The problem is I have to run a never-ending while to keep retriving all the data from the server I do it like this:
while ((inputLine = reader.ReadLine()) == null) { listBox1.Items.Add(reader.ReadLine()); }
The problem is that my form doesent respond (I cant use buttons, and such) since the while is never-ending Is there any way of adding a event that triggers when there is new data from the server? Here is my project: dumpen.dk/include/files/IrcBot.rar And a bonus question: When connecting to Quakenet and joining a channel it says: 451 Register first Why is that?
-
Hello. I have been creating a simple irc client that connects to a server and sends some simple commands to it I have also figured out how to retrive data from the server by using streams The problem is I have to run a never-ending while to keep retriving all the data from the server I do it like this:
while ((inputLine = reader.ReadLine()) == null) { listBox1.Items.Add(reader.ReadLine()); }
The problem is that my form doesent respond (I cant use buttons, and such) since the while is never-ending Is there any way of adding a event that triggers when there is new data from the server? Here is my project: dumpen.dk/include/files/IrcBot.rar And a bonus question: When connecting to Quakenet and joining a channel it says: 451 Register first Why is that?
Casper Hansen wrote:
while ((inputLine = reader.ReadLine()) == null) { listBox1.Items.Add(reader.ReadLine()); }
Are you sure that logic is correct? You have essentially written this: While the reader is exhausted add the next line to the list box. This will go into an infinite loop and effectively block your program for eternity, or until you externally kill the process, or until the memory of all those empty items in the list box is exhausted.
Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux * Mixins My Blog
-
Casper Hansen wrote:
while ((inputLine = reader.ReadLine()) == null) { listBox1.Items.Add(reader.ReadLine()); }
Are you sure that logic is correct? You have essentially written this: While the reader is exhausted add the next line to the list box. This will go into an infinite loop and effectively block your program for eternity, or until you externally kill the process, or until the memory of all those empty items in the list box is exhausted.
Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux * Mixins My Blog
Well no :P Thats why I ask here since I cant seem to come up with a solution
-
Well no :P Thats why I ask here since I cant seem to come up with a solution
Actually, your question was about whether a specific feature was available in a framework. You did not question the logic.
Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux * Mixins My Blog
-
Actually, your question was about whether a specific feature was available in a framework. You did not question the logic.
Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Crazy Extension Methods Redux * Mixins My Blog
I would like help with the logic as well or just some other soloution for my problem
-
Hello. I have been creating a simple irc client that connects to a server and sends some simple commands to it I have also figured out how to retrive data from the server by using streams The problem is I have to run a never-ending while to keep retriving all the data from the server I do it like this:
while ((inputLine = reader.ReadLine()) == null) { listBox1.Items.Add(reader.ReadLine()); }
The problem is that my form doesent respond (I cant use buttons, and such) since the while is never-ending Is there any way of adding a event that triggers when there is new data from the server? Here is my project: dumpen.dk/include/files/IrcBot.rar And a bonus question: When connecting to Quakenet and joining a channel it says: 451 Register first Why is that?
Is this the correct way of using thread?
using System;
using System.Windows.Forms;namespace mutlithread
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}// Event handler void FakeUIUpdater(string textboxText) { // Create a new delegate updater UIUpdaterDelegate updateUI = new UIUpdaterDelegate(UpdateUI); // Send the delegate to the winform this.Invoke(updateUI, new object\[\] { textboxText }); } // Create the delegate delegate void UIUpdaterDelegate(string textboxText); // Update the user interface with the arguments set earlier in fakeuiupdater protected void UpdateUI(string textboxText) { textBox1.Text = textboxText; } private void button1\_Click(object sender, EventArgs e) { FakeUIUpdater("test"); } }
}