Start() public method

public Start ( ) : void
return void
        //connects to irc server, gives a boolean back on succesfull connect etc
        public bool Connect()
        {
            try
            {
                irc = new TcpClient(newIP, newPort);
                stream = irc.GetStream();

                reader = new StreamReader(stream);
                writer = new StreamWriter(stream);

                ping = new Pinger(simpleirc, this);
                ping.Start();

                writeIrc("USER " + newUsername + " 8 * : Testing RareAMVS C# irc client");
                writeIrc("NICK " + newUsername);
                writeIrc("JOIN " + newChannel);

                simpleirc.DebugCallBack("succesful connected to the irc server!");

                receiverTask = new Task(StartReceivingChat);
                receiverTask.Start();
                receiverTask.Wait();
                return true;
            }
            catch(Exception e)
            {
                simpleirc.DebugCallBack("Error Connecting to IRC Server: \n " + e.ToString());
                return false;
            }
        }
Example #2
0
        //connects to irc server, gives a boolean back on succesfull connect etc
        public bool Connect()
        {
            try
            {
                irc    = new TcpClient(newIP, newPort);
                stream = irc.GetStream();

                reader = new StreamReader(stream);
                writer = new StreamWriter(stream);

                ping = new Pinger(simpleirc, this);
                ping.Start();

                writeIrc("USER " + newUsername + " 8 * : Testing RareAMVS C# irc client");
                writeIrc("NICK " + newUsername);
                writeIrc("JOIN " + newChannel);

                simpleirc.DebugCallBack("succesful connected to the irc server!");

                receiverTask = new Task(StartReceivingChat);
                receiverTask.Start();
                receiverTask.Wait();
                return(true);
            }
            catch (Exception e)
            {
                simpleirc.DebugCallBack("Error Connecting to IRC Server: \n " + e.ToString());
                return(false);
            }
        }