1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| Rs1.Open "select adresse_ip, NOM_CELLULE from serveur", cnn, adOpenKeyset, adLockOptimistic
If Rs1.RecordCount > 0 Then
j = 1
Rs1.AbsolutePosition = 1
MSFlexGrid1.Row = 0
MSFlexGrid1.Col = 0
Do While Not Rs1.EOF
MSFlexGrid1.TextMatrix(1, j) = Rs1.Fields("adresse_ip")
MSFlexGrid1.TextMatrix(2, j) = Rs1.Fields("NOM_CELLULE")
'Get the sockets ready.
If SocketsInitialize() Then
'Address to ping
strIPAddress = MSFlexGrid1.TextMatrix(1, j)
'Ping the IP that is passing the address and get a reply.
lngSuccess = ping(strIPAddress, Reply)
'Display the results.
Debug.Print "Address to Ping: " & strIPAddress
Debug.Print "Raw ICMP code: " & lngSuccess
Debug.Print "Ping Response Message : " & EvaluatePingResponse(lngSuccess)
Debug.Print "Time : " & Reply.RoundTripTime & " ms"
'Clean up the sockets.
SocketsCleanup
Else
'Winsock error failure, initializing the sockets.
Debug.Print WINSOCK_ERROR
End If
With MSFlexGrid1
.FillStyle = flexFillRepeat
.Col = j
.Row = 0
.ColAlignment(j) = 4
.RowHeight(0) = 1000
If EvaluatePingResponse(lngSuccess) = "Success!" Then
Set .CellPicture = LoadPicture("c:\application PFE\serveur1.jpg")
Else
Set .CellPicture = LoadPicture("c:\application PFE\serveur2.jpg")
End If
End With
j = j + 1
Rs1.MoveNext
Loop
End If
Rs1.Close |