Dear group
i im trying make a small apps there is testing the ip numbers and domains name
found in a mail header on one or more RBL servers and when doing this it is slow to
wait for one ip number to resolve before going to the next so i im thinking maybe
multi threading will make it faster, is there anyone there will help me making my
small apps to a multithread apps ?
i im a beginner and i have try to read some docs on
threading but it is to complex for me, so be nice with me :-)
this is a small sample code and not the full code (but working)
----------------------------------------------------------------------------------
Sub Main()
'dim things
Dim RBL_array() As String
Dim loop_id1 As Integer
Dim hostInfo As System.Net.IPHostEntry
Dim IPnumber As String
'puting some sample data in the array
ReDim Preserve RBL_array(8)
RBL_array.SetValue("1.0.0.127.relays.ordb.org", 0)
RBL_array.SetValue("2.0.0.127.relays.ordb.org", 1)
RBL_array.SetValue("3.0.0.127.relays.ordb.org", 2)
RBL_array.SetValue("4.0.0.127.relays.ordb.org", 3)
RBL_array.SetValue("5.0.0.127.relays.ordb.org", 4)
RBL_array.SetValue("6.0.0.127.relays.ordb.org", 5)
RBL_array.SetValue("7.0.0.127.relays.ordb.org", 6)
RBL_array.SetValue("8.0.0.127.relays.ordb.org", 7)
RBL_array.SetValue("9.0.0.127.relays.ordb.org", 8)
'turn errors off
On Error Resume Next
' looping over the array and resolve
loop_id1 = 0
Do Until loop_id1 = UBound(RBL_array) + 1
'getting the host info
hostInfo = System.Net.Dns.Resolve(RBL_array.GetValue(loop_id1 ))
IPnumber = "Not found"
IPnumber = hostInfo.AddressList(0).ToString
'put some info to con
Console.WriteLine(RBL_array.GetValue(loop_id1) & " -> " & IPnumber)
'count 1 up
loop_id1 = loop_id1 + 1
Loop
'make a break
Console.WriteLine(vbCrLf & "Hit Enter")
Console.Read()
End Sub
----------------------------------------------------------------------------------
--
Mvh
Thomas Bøjstrup Johansen