public SocketManager() { this._standardPriority = MessagePriority.Normal;/*/MessagePriority.RealTime;*/ // listener this.listener_thread = new Listener(this); this.listener_thread.Start(); // reader this.reader_thread = new Reader(this); this.reader_thread.Start(); // writer this.writer_thread = new Writer(this); this.writer_thread.Start(); }
// todo could be static return instance of this class? public new void Connect() { // todo ensure required filds are populated // create the tcp connection base.Connect(); // start listening _listener = new Listener(this, TcpClient.GetStream()); _listener.ReceivedReply += ProcessReply; // todo instead of passing client maybe lisenter subscribe to client events? _listenerThread = new Thread(_listener.Listen); _listenerThread.Start(); // offical RFC 2812 doesn't support a message to start the // client registration. additionally CAP does. Thread.Sleep(500); // send the password is there is one if (!string.IsNullOrEmpty(ServerPass)) this.Pass(ServerPass); // register nickname message this.Nick(Nickname); // send user message this.User(Nickname, (User.Mode) 8, RealName); }