Results 1 to 2 of 2

Thread: My IRC Bot won't reconnect to my IRC server

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2008
    Posts
    30

    Unhappy My IRC Bot won't reconnect to my IRC server

    Okay i have a little problem here.

    I have a ping class as such

    Code:
    using System;
    using System.Net.Sockets;
    using System.Threading;
    using z3r0xB0t;
    using BOT;
    
    class Ping
    {
        public static void Run()
        {
            while (true)
            {
                try
                {
                    BotMain.writer.WriteLine("PONG :" + Config.SERVER);
                    BotMain.writer.Flush();
                }
                catch (Exception)
                {
                    BotMain.irc = new TcpClient();
                    Thread.Sleep(8000);
                    BotMain.Main(null);
                }
                Thread.Sleep(12000);
            }
        }
    }
    and the beginning connection in the main module is as such

    Code:

    Code:
    NetworkStream stream;
    string inputLine;
    StreamReader reader;
    Boolean logged = false;
    String cuser = "./*&$%^";
    try
    {
        irc = new TcpClient(Config.SERVER, Config.PORT);
    }
    catch (Exception) { irc = new TcpClient(); Main(null); }
    stream = irc.GetStream();
    reader = new StreamReader(stream);
    writer = new StreamWriter(stream);
    writer.AutoFlush = true;
    Thread ping = new Thread(new ThreadStart(Ping.Run));
    ping.Start();
    And at first it connects fine, but when i close my test server, and open it again, the bot won't automaticly reconnect.

    any suggestions on what i am doing wrong here?

    And is there any code to have them also check every x seconds if they are still in the channel and have them rejoin if they aren't?

    thanks!

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Aug 2008
    Posts
    30

    Re: My IRC Bot won't reconnect to my IRC server

    Any help at all here, please?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width