7
public static string SERVER = "irc.rizon.net";
private static int PORT = 6667;
private static string USER = "Test C# Irc bot";
private static string NICK = "Testing";
private static string CHANNEL = "#Test0x40";
public static void Main(string[] args)
{
NetworkStream stream;
TcpClient irc;
StreamReader reader;
StreamWriter writer;
irc = new TcpClient(SERVER, PORT);
stream = irc.GetStream();
reader = new StreamReader(stream);
writer = new StreamWriter(stream);
writer.WriteLine("NICK " + NICK);
writer.Flush();
writer.WriteLine("JOIN " + CHANNEL);
writer.Flush();
Console.ReadKey(true);
}
为什么我的IRC bot不能连接?为什么我的IRC bot不能连接?
什么让你觉得它没有连接?有错误吗? – 2010-02-27 18:43:22
检查端口6667是否被阻塞。在我的情况下,我在一个代理服务器已经阻止6667.所以我无法连接到6667的IRC。 – 2010-02-27 18:46:05
@Mr。夏普:你的机器人实际上没有连接?即:如果你/谁测试(我认为这是正确的命令),他不在吗?如果您从StreamReader读取的是从服务器获取任何错误消息? – 2010-02-27 19:33:56