Om een netwerk verbinding heb ik een programma geschreven in VB dat om de zoveel tijd een ping verstuurt, maar het probleem is dat met de huidige code ik een error krijg dat de ip buffer te klein is (al bij 250 Byte's) ik ben al even aan het googlen geweest en heb al op vbcode.com en a1vbcode.com gekeken maar kan nergens iets vinden.
Is er iemand die mij hiermee kan helpen, het programma moet namelijk bij klanten als connectie test draaien en het zou mooi zijn als ik boven de 250 bytse kan versturen
alvast bedankt
hieronder de code:
Public Function Ping(szAddress As String, ECHO As ICMP_ECHO_REPLY) As Long
Dim hPort As Long
Dim dwAddress As Long
Dim sDataToSend As String
Dim iOpt As Long
sDataToSend = Form1.Text3.Text
dwAddress = AddressStringToLong(szAddress)
Call SocketsInitialize
hPort = IcmpCreateFile()
If IcmpSendEcho(hPort, _
dwAddress, _
sDataToSend, _
Len(sDataToSend), _
0, _
ECHO, _
Len(ECHO), _
PING_TIMEOUT) Then
'the ping succeeded,
'.Status will be 0
'.RoundTripTime is the time in ms for
' the ping to complete,
'.Data is the data returned (NULL terminated)
'.Address is the Ip address that actually replied
'.DataSize is the size of the string in .Data
Ping = ECHO.RoundTripTime
Else: Ping = ECHO.status * -1
End If
Call IcmpCloseHandle(hPort)
Call SocketsCleanup
End Function
Is er iemand die mij hiermee kan helpen, het programma moet namelijk bij klanten als connectie test draaien en het zou mooi zijn als ik boven de 250 bytse kan versturen
alvast bedankt
hieronder de code:
Public Function Ping(szAddress As String, ECHO As ICMP_ECHO_REPLY) As Long
Dim hPort As Long
Dim dwAddress As Long
Dim sDataToSend As String
Dim iOpt As Long
sDataToSend = Form1.Text3.Text
dwAddress = AddressStringToLong(szAddress)
Call SocketsInitialize
hPort = IcmpCreateFile()
If IcmpSendEcho(hPort, _
dwAddress, _
sDataToSend, _
Len(sDataToSend), _
0, _
ECHO, _
Len(ECHO), _
PING_TIMEOUT) Then
'the ping succeeded,
'.Status will be 0
'.RoundTripTime is the time in ms for
' the ping to complete,
'.Data is the data returned (NULL terminated)
'.Address is the Ip address that actually replied
'.DataSize is the size of the string in .Data
Ping = ECHO.RoundTripTime
Else: Ping = ECHO.status * -1
End If
Call IcmpCloseHandle(hPort)
Call SocketsCleanup
End Function