Java IRC ping请求

Java IRC ping请求,java,ping,irc,Java,Ping,Irc,我想通过我自己的Java客户端连接到IRC,但有一个问题 每当IRC服务器向我发送ping请求(如ping:6E17BFF)时,我必须返回此PONG:6E17BFF 您可以在下面看到我正在使用的代码。我做错什么了吗 每次连接时,我都会收到此消息 NOTICE AUTH :*** Looking up your hostname... NOTICE AUTH :*** Couldn't resolve your hostname; using your IP address instead PIN

我想通过我自己的Java客户端连接到IRC,但有一个问题

每当IRC服务器向我发送ping请求(如ping:6E17BFF)时,我必须返回此PONG:6E17BFF

您可以在下面看到我正在使用的代码。我做错什么了吗

每次连接时,我都会收到此消息

NOTICE AUTH :*** Looking up your hostname...
NOTICE AUTH :*** Couldn't resolve your hostname; using your IP address instead
PING :6E17BFF
PONG :6E17BFF
ERROR :Closing Link: TestNick[ipaddress] (Ping timeout: 33 seconds)
我希望你能帮助我

代码


这是我用来在教学机器人中处理乒乓球的代码。正如您将看到的,我保留了用于验证流程是否正常工作的测试响应

//****************************************************************************** 
//PING PONG Handler and while loop test. Tests to be removed before full implementation
//******************************************************************************
    while((line = in.readLine()) != null) {
     System.out.println("<--" + line);
        if (line.startsWith("PING")) {
         //sendPrivmsg("#Test", "The server just PINGED!");
          //sendPrivmsg("#Test", "Yes, and it was answered with a PONG!");
            writeLine(line.replace("PING", "PONG"));
             //sendPrivmsg("#Test", "This is a private message to channel #Test Pong Pong Pong Pong Pong");
        }
/*********************************************************************************************************
//乒乓球处理器和while循环测试。在完全实施之前要删除的测试
//******************************************************************************
而((line=in.readLine())!=null){

System.out.println("不会解决您的问题,但如果您想让生活更轻松,您可以使用中的功能。其中还提供了源代码。可能是因为您的PONG消息没有真正被发送?请删除\n\r..为什么您认为必须将\n\r放在末尾,而且顺序是\r\n,CR LF不是LF CR,请尝试\n解决问题正在替换\n而不是\n\r\n
//****************************************************************************** 
//PING PONG Handler and while loop test. Tests to be removed before full implementation
//******************************************************************************
    while((line = in.readLine()) != null) {
     System.out.println("<--" + line);
        if (line.startsWith("PING")) {
         //sendPrivmsg("#Test", "The server just PINGED!");
          //sendPrivmsg("#Test", "Yes, and it was answered with a PONG!");
            writeLine(line.replace("PING", "PONG"));
             //sendPrivmsg("#Test", "This is a private message to channel #Test Pong Pong Pong Pong Pong");
        }