ike nwaogu

ike nwaogu

  • NA
  • 1
  • 913

IRC client not receiving ident request

Jan 4 2015 7:29 PM
I am writing an irc bot and the bot requires a server to handle ident request from the irc server I am connecting to. Well to make a long story short I wrote the server and the client but the irc server keeps giving me the message "No ident response".Anybody know why?
 
here is the server code:
 
 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;
using System.IO;
using System.Threading;

namespace TCPClient
{
public class IdentServer
{

public int Port { get; set; }
public TcpListener listener = null;
private Thread listenerThread;
private const string Reply = " : USERID : UNIX : ";
private const string userName = "JAMESBOT1";
public IdentServer(int port)
{
this.Port = port;
}
public void start()
{
listener = new TcpListener(new IPEndPoint(IPAddress.Any, Port));
listener.Start();
listenerThread = new Thread(new ThreadStart(Listener));
listenerThread.Start();
}
public void stop()
{
listenerThread.Abort();
}
public void Listener()
{
while (true)
{
try
{
TcpClient c = listener.AcceptTcpClient();
}
catch(Exception e)
{
Console.WriteLine("Error:{0}", e.Message);
}
}
}
public void HandleClient(TcpClient client)
{
char[] rBuf = new char[3000];
NetworkStream netStream = client.GetStream();
StreamReader reader = new StreamReader(netStream);
string line = reader.ReadLine();
Console.WriteLine(line);
StreamWriter writting = new StreamWriter(netStream);
writting.WriteLine(line.Trim()+ Reply + userName);
writting.Flush();
client.Close();
netStream.Close();
}

}
}