09/12/11 1:51
mastergov
Option Explicit Sub Pause(ByVal interval As Double) Dim Current As Double Current = Timer Do While Timer - Current < interval DoEvents Loop End Sub Private Sub cmdConnect_Click() Winsock.RemoteHost = "irc.tiscali.it" ' this is the Ip of the server 127.0.0.1 loops back to your own computer Winsock.RemotePort = 6667 ' this is the port it must be the same as the server Winsock.Connect ' connect! End Sub Private Sub cmdSend_click() Dim info1, info2, info3 As String Dim nick(5) As String Dim whois As String info1 = "nick" info2 = "searchBot" info3 = "user Code_Master 95.251.39.70 irc.tiscali.it Coder" nick(0) = "zappa" nick(1) = "cone" nick(3) = "LosCo" nick(4) = "Tapparella" nick(5) = "mitico" whois = "whois" Dim i As Integer Dim numeroriga As Integer Dim riga As String, c As Integer numeroriga = 1 For i = 1 To 20 Close #1 Open App.Path & "\lista.txt" For Input As #1 Do c = c + 1 Line Input #1, riga Debug.Print "Mi sto connettendo a questo server :" & riga Winsock.RemoteHost = riga Winsock.RemotePort = 6667 Winsock.Connect Pause 2 Winsock.SendData info1 & " " & info2 & vbNewLine ' sends the data in the textbox txtWindow.Text = txtWindow.Text & vbNewLine & info1 & " " & info2 & vbNewLine & info3 & vbNewLine ' displays data Winsock.SendData info3 & vbNewLine Pause 3 Dim fioco As String fioco = txtWindow.Text Dim h As Integer Open "c:\results.txt" For Append As #2 For h = 0 To 5 Debug.Print "Sto cercando :" & nick(h) Winsock.SendData whois & " " & nick(h) & vbNewLine Print #2, fioco Pause 5 Next Close #2 Loop Until EOF(1) Or c = numeroriga txtWindow.SelStart = Len(txtWindow.Text) ' this just positions the text box to focus on the newest piece of information! txtchatBox.Text = "" ' just empties the text box Winsock.Close Pause 2 Next End Sub Private Sub Form_Load() Dim c As Integer c = 1 End Sub Private Sub winsock_DataArrival(ByVal bytesTotal As Long) Dim incommingData As String Winsock.GetData incommingData txtWindow.Text = txtWindow.Text & vbNewLine & incommingData txtWindow.SelStart = Len(txtWindow.Text) 'this just positions the text box to focus on the newest piece of information! End Sub Private Sub winsock_connect() Debug.Print "You are connected to : " End Sub
In pratica questo programmino va a leggere una lista di server presente nel file lista.txt tutti i nomi dei server e si collegga a tutti, cercando i nick che sono inseriti. o almeno dovrebbe!
però non capisco perchè il primo giro lo fa ammodo e si collega al primo server quindi fa i whois e salva tutto in un file, al secondo giro mi da errore
su
Winsock.RemoteHost = riga
eppure sopra ho messo un debug.print e come risultato nel debuger torna scritto ammodo, che dite? dove è l'inghippo?
aaa