chaima01
Messages postés24Date d'inscriptionlundi 1 mars 2010StatutMembreDernière intervention11 novembre 2012
-
26 avril 2011 à 00:21
chaima01
Messages postés24Date d'inscriptionlundi 1 mars 2010StatutMembreDernière intervention11 novembre 2012
-
26 avril 2011 à 13:11
bonsoir ,
je veux réaliser le ping. j'ai déjà trouver le code sur l'internet mais je veux ajouter que si le ping est réalisé avec succé la zone textbox devient vert sinon rouge.
voici mon essai mais il y a un erreur au niveau de la condition if
Private Sub Command1_Click()
Dim Reply As ICMP_ECHO_REPLY
Dim lngSuccess As Long
Dim strIPAddress As String
Label2.BackColor = &H80FF80
Label2.Caption = "Surveillance Active"
'Get the sockets ready.
If SocketsInitialize() Then
'Address to ping
strIPAddress = "127.0.0.1"
'Ping the IP that is passing the address and get a reply.
lngSuccess = ping(strIPAddress, Reply)
cs_Jack
Messages postés14006Date d'inscriptionsamedi 29 décembre 2001StatutModérateurDernière intervention28 août 201579 26 avril 2011 à 09:26
Salut
Avec un retour, lngSuccess, de type Long, je ne vois pas trop ce que peut contenir ce retour. Il faudrait le demander au créateur du code ou regarder, analyser ce qui se passe dans la Sub Ping et EvaluatePingResponse
Trop peu d'élément pour te répondre.
Fais au moins l'effort de comprendre le code.
Que renvoie lngSuccess quand ça se passe bien ?
Et quand ça se passe mal ?
Que renvoie la fonction EvaluatePingResponse ?
Que contient-elle ?
Vala
Jack, MVP VB NB : Je ne répondrai pas aux messages privés
Le savoir est la seule matière qui s'accroit quand on la partage (Socrate) [img]http://allproj
chaima01
Messages postés24Date d'inscriptionlundi 1 mars 2010StatutMembreDernière intervention11 novembre 2012 26 avril 2011 à 13:11
je vient de résoudre ce problème comme ça :
Public Function EvaluatePingResponse(PingResponse As Long) As String
Select Case PingResponse
'Success
Case ICMP_SUCCESS: EvaluatePingResponse = "Success!"
cartographie.List1.BackColor = &H80FF80
'Some error occurred
Case ICMP_STATUS_BUFFER_TO_SMALL: EvaluatePingResponse = "Buffer Too Small"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_DESTINATION_NET_UNREACH: EvaluatePingResponse = "Destination Net Unreachable"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_DESTINATION_HOST_UNREACH: EvaluatePingResponse = "Destination Host Unreachable"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_DESTINATION_PROTOCOL_UNREACH: EvaluatePingResponse = "Destination Protocol Unreachable"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_DESTINATION_PORT_UNREACH: EvaluatePingResponse = "Destination Port Unreachable"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_NO_RESOURCE: EvaluatePingResponse = "No Resources"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_BAD_OPTION: EvaluatePingResponse = "Bad Option"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_HARDWARE_ERROR: EvaluatePingResponse = "Hardware Error"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_LARGE_PACKET: EvaluatePingResponse = "Packet Too Big"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_REQUEST_TIMED_OUT: EvaluatePingResponse = "Request Timed Out"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_BAD_REQUEST: EvaluatePingResponse = "Bad Request"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_BAD_ROUTE: EvaluatePingResponse = "Bad Route"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_TTL_EXPIRED_TRANSIT: EvaluatePingResponse = "TimeToLive Expired Transit"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_TTL_EXPIRED_REASSEMBLY: EvaluatePingResponse = "TimeToLive Expired Reassembly"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_PARAMETER: EvaluatePingResponse = "Parameter Problem"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_SOURCE_QUENCH: EvaluatePingResponse = "Source Quench"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_OPTION_TOO_BIG: EvaluatePingResponse = "Option Too Big"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_BAD_DESTINATION: EvaluatePingResponse = "Bad Destination"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_NEGOTIATING_IPSEC: EvaluatePingResponse = "Negotiating IPSEC"
cartographie.List1.BackColor = &H8080FF
Case ICMP_STATUS_GENERAL_FAILURE: EvaluatePingResponse = "General Failure"
cartographie.List1.BackColor = &H8080FF
'Unknown error occurred
Case Else: EvaluatePingResponse = "Unknown Response"
cartographie.List1.BackColor = &H8080FF
End Select
End Function
Private Sub Command1_Click()
Dim Reply As ICMP_ECHO_REPLY
Dim lngSuccess As Long
Dim strIPAddress As String
Label2.BackColor = &H80FF80
Label2.Caption = "Surveillance Active"
'Get the sockets ready.
If SocketsInitialize() Then
'Address to ping
strIPAddress = "127.0.0.1"
'Ping the IP that is passing the address and get a reply.
lngSuccess = ping(strIPAddress, Reply)
'Winsock error failure, initializing the sockets.
Debug.Print WINSOCK_ERROR
End If
End Sub
mais comment je peut faire le ping sur plusieurs adresses ip qui se trouve dans la base de donnée (table serveur, table switch,table routeur) ? aussi, si le ping est réussie je doit colorer la zone de tableau en vert sinon en rouge (je ne sais pas comment faire un tableau dans une listbox )
SVP aider moi