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:
  1. Private Sub Command1_Click()
  2.     Winsock2.Close
  3.     Winsock2.RemoteHost = "irc.datviet.net"
  4.     Winsock2.RemotePort = 6667
  5.     Winsock2.Connect
  6.     If Winsock2.State <> sckConnected Then
  7.         MsgBox "can not connect"
  8.          Exit Sub
  9.     Else
  10.         MsgBox "connected"
  11.     End If
  12. End Sub
  13. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  14.     Dim data As String
  15.     Winsock1.GetData data
  16.     MsgBox data
  17. End Sub