I have a problem and hope someone can help.
when I run this code I cant connect to a server, I just get a error
message returned:
The attempt to connect timed out
or
Authoritive answer: Host not found
I've tried several irc servers but always get an error.
Can someone tell me what is wrong with this code?
I'm new to winsock and have been getting code from various
places but nothing seems to work and I cant find any decent help
with my problem.
Code:Private Sub Command1_Click() Winsock1(0).SendData Text1.Text & vbCrLf End Sub Private Sub Command2_Click() Dim RemHost As String Dim RemPort As Integer Dim HostName As String RemHost = Text2.Text RemPort = Text3.Text HostName = Text4.Text List3.AddItem "***Connecting..." Winsock1(0).Connect RemHost, RemPort End Sub Private Sub Command3_Click() Winsock1(0).Close List3.AddItem "***Disconnected." End Sub Private Sub Winsock1_Connect(Index As Integer) List3.AddItem "***Connected!", vbInformation ' Introduce ourselves to the IRC server. Our nickname will be "WVB_Test" With Winsock1(0) .SendData "NICK WVB_Test" & vbCrLf .SendData "USER WVB_Test " & Winsock1(0).LocalHostName & " " & _ UCase(Winsock1(0).LocalHostName & ":" & Winsock1(0).LocalPort & "/0") & _ " :WinsockVB Test Client" & vbCrLf End With End Sub Private Sub Winsock1_DataArrival(Index As Integer, ByVal bytesTotal As Long) Dim strBuff As String Winsock1(0).GetData strBuff, vbString List3.AddItem vbCrLf & strBuff, vbInformation End Sub Private Sub Winsock1_Error(Index As Integer, ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean) List3.AddItem "***Error occured : (" & Scode & ":" & Description & ")" Winsock1(0).Close List3.AddItem "***Connection Closed." End Sub
Any ideas/help would be great, thanks.




Reply With Quote