public void run()
		{
		try
			{
			boolean running = true;
			while (running)
				{
				try
					{
					String line = null;
					while ((line = _breader.readLine()) != null)
						{
						try
							{
							_bot.handleLine(line);
							}
						catch (Throwable t)
							{
							// Stick the whole stack trace into a String so we can output it nicely.
							StringWriter sw = new StringWriter();
							PrintWriter pw = new PrintWriter(sw);
							t.printStackTrace(pw);
							pw.flush();
							StringTokenizer tokenizer = new StringTokenizer(sw.toString(),"\r\n");
							synchronized (_bot)
								{
								_bot.log("### Your implementation of PircBot is faulty and you have");
								_bot.log("### allowed an uncaught Exception or Error to propagate in your");
								_bot.log("### code. It may be possible for PircBot to continue operating");
								_bot.log("### normally. Here is the stack trace that was produced: -");
								_bot.log("### ");
								while (tokenizer.hasMoreTokens())
									{
									_bot.log("### " + tokenizer.nextToken());
									}
								}
							}
						}
					// The server must have disconnected us.
					running = false;
					}
				catch (InterruptedIOException iioe)
					{
					// This will happen if we haven't received anything from the server for a while.
					// So we shall send it a ping to check that we are still connected.
					this.sendRawLine("PING " + (System.currentTimeMillis() / 1000));
					// Now we go back to listening for stuff from the server...
					}
				}
			}
		catch (Exception e)
			{
			// Do nothing.
			}

		// If we reach this point, then we must have disconnected.
		try
			{
			_socket.close();
			}
		catch (Exception e)
			{
			// Just assume the socket was already closed.
			}

		if (!_disposed)
			{
			_bot.log("*** Disconnected.");
			_isConnected = false;
			_bot.onDisconnect();
			}

		}