private void Connection(string host, int port) { client = new Client(host, port); client.SynchronizingObject = this; client.RawMessageSent += MessageSent; client.RawMessageReceived += MessageReceived; client.ConversationMessageReceived += ConversationMessageReceived; client.Connect(); client.WaitForConnected(); if(client.ConnectionStatus != ConnectionStatus.Connected) { conversation.Text += string.Format(@"Could not connect to {0} on port {1}." + Environment.NewLine, host, port); return; } clientThread = new Thread(() => { while(client != null) { client.HandleMessageBlock(); } }); clientThread.Start(); }
void Run() { using(client = new Client("irc.slagg.org", 6667)) { Console.WriteLine("Connecting..."); client.Connect(); client.WaitForConnected(); Console.WriteLine("Connected!"); LoadPlugins(); client.JoinChannel("#test"); while(client.ConnectionStatus == ConnectionStatus.Connected) { client.HandleMessageBlock(); } } }