All pastes #510701 Raw Edit

Stuff

public text v1 · immutable
·published 2007-05-26 00:44 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
using System.IO;

class Bot
{
    public static void Main(string[] args)
    {
        System.Console.WriteLine("Attempting to connect to server...");
        TcpClient client;
        NetworkStream stream;
        StreamReader recv;
        StreamWriter send;
        try
        {
            client = new TcpClient("irc.pulltheplug.org", 6667);
        }
        catch
        {
            System.Console.WriteLine("Failed to connect");
            return;
        }

        stream = client.GetStream();
        recv = new StreamReader(stream);
        send = new StreamWriter(stream);

        while (!recv.EndOfStream)
        {
            try
            {
                Console.WriteLine(recv.ReadLine());
            }
            catch
            {
                System.Console.WriteLine("Failed to read from network stream");
                return;
            }
        }

        stream.Close();
    }
}