wrong protocol or connect request, where's error ?
Hello everyone, at first im sorry about my bad English.
I am learning Vb6. I want co code a client software to communicate with IRC protocol. I can open a connect to IRC server on 6667 port. But when i try to send data to it to register my nick, user and join to channel so i get an error is :"Wrong protocol or connect state for the requested transaction or request" . I dont know where is error ? Please help me !Thanks in advance.
Here is my code :
vb Code:
Private Sub Command1_Click()
Winsock2.Close
Winsock2.RemoteHost = "irc.datviet.net"
Winsock2.RemotePort = 6667
Winsock2.Connect
If Winsock2.State <> sckConnected Then
MsgBox "can not connect"
Exit Sub
Else
MsgBox "connected"
End If
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim data As String
Winsock1.GetData data
MsgBox data
End Sub
Re: wrong protocol or connect request, where's error ?
Welcome to VBForums.
Exactly what are you sending?
Re: wrong protocol or connect request, where's error ?
Well i want to send data,for exam:
Code:
winsock.sendData "Nick " & "netghost" & vbCrlf
winsock.sendData "USER " & "netghost" & " 0 0 " & "netghost" & vbCrlf
winsock.sendData "JOIN #CB" & vbCrlf
When i connect to IRC i have to register a nick for myself . But there is an error when i try to send data to it. I done it with another programming languages but with vb i cant do it. Please help me.
Re: wrong protocol or connect request, where's error ?
Do you have some reference documents on the IRC protocol?
Re: wrong protocol or connect request, where's error ?
Here's the RFC for IRC. It sounds like you're violating the protocol rules somewhere in the communication, you migt want to read the RFC if you havent already.
Re: wrong protocol or connect request, where's error ?
Quote:
Do you have some reference documents on the IRC protocol?
Yes i have. I done it with autoIT and its ok. I have the document about IRC protocol and i already read it. Hmm let me try to read it again. Thank you !
Re: wrong protocol or connect request, where's error ?
Your code looks a little 'odd'.
In your first Post you are connecting with Winsock2 and expecting data to arrive on Winsock1, then in your second Post you are trying to send data on Winsock - that's 3 Winsocks and only one might be connected. You should be using just one Winsock control.
Re: wrong protocol or connect request, where's error ?
Hmm i fixed it but it doesnt work. I dont know where is my error ?
Re: wrong protocol or connect request, where's error ?
Perhaps you should post all your code than we might see what's going wrong