2010-07-08 69 views
0

我不能傍回PING到IRC,發回了「你必須先註冊」的錯誤,這裏是我使用的代碼:VB6/IRC PING和PONG問題

Private Sub wsConnect_DataArrival(ByVal bytesTotal As Long) 
    Dim strData As String 

    wsConnect.GetData strData 

    If InStr(strData, "PING") <> 0 Then 
    MsgBox ("Success!") 'Check it's receiving it. 
     wsConnect.SendData Replace(strData, "PING", "PONG") & vbCrLf 
    End If 

    Me.txtDataIn.Text = Me.txtDataIn.Text & strData 
End Sub 

任何幫助?

回答

1

再在RFC2812的IRC協議defenition幫助:http://tools.ietf.org/html/rfc2812

來自服務器的PING命令看起來是這樣的:

PING :3213546231 

此命令的正確答案是:

PONG :3213546231 

使用與PING一起發送的相同標識符。

/^PING :(.+)/ --> respond with "PONG :$1" 

錯誤消息指出,您沒有以符合方式連接服務器。建立TCP套接字後,您必須發送以下命令:

NICK <yourNickName> 
USER <yourUserName> 32 . :<yourRealName> 

然後您將收到MOTD。此後將開始「乒乓」遊戲,以確保您的連接仍然存在。

或者你正在連接需要服務器身份驗證:

如果是這樣,你必須發送命令:

PASS <yourpassword>