Chrissie
May 29th, 2003, 06:05 AM
I'm trying to connect to an IRC using some C# code...I found here (http://www.c-sharpcorner.com/Network/IrcBotPH.asp)
static void Main (string[] args)
{
NetworkStream stream;
TcpClient irc;
string inputLine;
StreamReader reader;
string nickname;
try
{
irc = new TcpClient (SERVER, PORT);
stream = irc.GetStream ();
reader = new StreamReader (stream);
writer = new StreamWriter (stream);
// Start PingSender thread
PingSender ping = new PingSender ();
ping.Start ();
writer.WriteLine (USER);
writer.Flush ();
writer.WriteLine ("NICK " + NICK);
writer.Flush ();
writer.WriteLine ("JOIN " + CHANNEL);
writer.Flush ();
while (true)
{
while ( (inputLine = reader.ReadLine () ) != null )
{
if (inputLine.EndsWith ("JOIN :" + CHANNEL) )
{
// Do some Stuff in the IRC CHannel
}
}
// Close all streams
writer.Close ();
reader.Close ();
irc.Close ();
}
}
For some reason it's not letting me in...while connecting it's giving me this back...
"NOTICE AUTH :*** Looking up your hostname"
"NOTICE AUTH :*** Found your hostname, cached"
"NOTICE AUTH :*** Checking Ident"
"NOTICE AUTH :*** No ident response"
"PING :1475001920"
":splatterworld3.de.quakenet.org 451 ChrissieBOT ChrissieBOT :Register first."
I think I have to react to the ping or probably need to do some register thing? Does anyone have any experience with this code?
static void Main (string[] args)
{
NetworkStream stream;
TcpClient irc;
string inputLine;
StreamReader reader;
string nickname;
try
{
irc = new TcpClient (SERVER, PORT);
stream = irc.GetStream ();
reader = new StreamReader (stream);
writer = new StreamWriter (stream);
// Start PingSender thread
PingSender ping = new PingSender ();
ping.Start ();
writer.WriteLine (USER);
writer.Flush ();
writer.WriteLine ("NICK " + NICK);
writer.Flush ();
writer.WriteLine ("JOIN " + CHANNEL);
writer.Flush ();
while (true)
{
while ( (inputLine = reader.ReadLine () ) != null )
{
if (inputLine.EndsWith ("JOIN :" + CHANNEL) )
{
// Do some Stuff in the IRC CHannel
}
}
// Close all streams
writer.Close ();
reader.Close ();
irc.Close ();
}
}
For some reason it's not letting me in...while connecting it's giving me this back...
"NOTICE AUTH :*** Looking up your hostname"
"NOTICE AUTH :*** Found your hostname, cached"
"NOTICE AUTH :*** Checking Ident"
"NOTICE AUTH :*** No ident response"
"PING :1475001920"
":splatterworld3.de.quakenet.org 451 ChrissieBOT ChrissieBOT :Register first."
I think I have to react to the ping or probably need to do some register thing? Does anyone have any experience with this code?