All pastes #235523 Raw Edit

Loop

public java v1 · immutable
·published 2006-11-03 08:38 UTC
rendered paste body
import java.io.*;import java.net.*;public class Loop extends NET implements Runnable {	public void run()// throws Exception,IOException	{	   //String line = null;      while ((line = reader.readLine( )) != null)      {		   if (line.indexOf("004") >= 0) 		   {		        break;	      }         else if (line.indexOf("433") >= 0)          {              pane.setText(pane.getText() + new String("Nickname already in use.\n"));              return;         }      }        writer.write("JOIN " + channel + "\r\n");        writer.flush( );        while ((line = reader.readLine( )) != null)         {            if (line.toLowerCase( ).startsWith("PING "))             {                writer.write("PONG " + line.substring(5) + "\r\n");                writer.write("PRIVMSG " + channel + " :I got pinged!\r\n");                writer.flush( );            }else {                pane.setText(pane.getText() + line + "\n");            }        }	}}