views:

28

answers:

2

I am not able to PONG back the PING to IRC, which sends back a "You must register first" error, here is the code I'm using:

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

Any help?

A: 

Again the IRC-protocol defenition in RFC2812 helps: http://tools.ietf.org/html/rfc2812

The PING-command from the server looks something like this:

PING :3213546231

The correct answer on this command is:

PONG :3213546231

using the same identifier, which was send with the PING.

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

The error-message points out, that you did not connect the server in a conform way. After establishing the TCP-socket, you have to send the following commands:

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

Then you will receive the MOTD. The "PING - PONG" play will begin after this, to make sure your connection is still alive.

Or you are connecting a server that needs authentication:

If so, you have to send the command:

PASS <yourpassword>
Erik
A: 

You should not send back the PONG message until you have recieved the RPL_WELCOME numeric (001), indicating that you have successfully registered.

This won't happen until you've sent your NICK, USER and possibly PASS commands.

caf