EnableExplicit Global PBEx_ICMP #PBEx_ICMP_Status_BadDestination = 11018 #PBEx_ICMP_Status_BadHeader = 11042 #PBEx_ICMP_Status_BadOption = 11007 #PBEx_ICMP_Status_BadRoute = 11012 #PBEx_ICMP_Status_DestinationHostUnreachable = 11003 #PBEx_ICMP_Status_DestinationNetworkUnreachable = 11002 #PBEx_ICMP_Status_DestinationPortUnreachable = 11005 #PBEx_ICMP_Status_DestinationProhibited = 11004 #PBEx_ICMP_Status_DestinationProtocolUnreachable = 11004 #PBEx_ICMP_Status_DestinationScopeMismatch = 11045 #PBEx_ICMP_Status_DestinationUnreachable = 11040 #PBEx_ICMP_Status_HardwareError = 11008 #PBEx_ICMP_Status_IcmpError = 11044 #PBEx_ICMP_Status_NoResources = 11006 #PBEx_ICMP_Status_PacketTooBig = 11009 #PBEx_ICMP_Status_ParameterProblem = 11015 #PBEx_ICMP_Status_SourceQuench = 11016 #PBEx_ICMP_Status_Success = 0 #PBEx_ICMP_Status_TimedOut = 11010 #PBEx_ICMP_Status_TimeExceeded = 11041 #PBEx_ICMP_Status_TtlExpired = 11013 #PBEx_ICMP_Status_TtlReassemblyTimeExceeded = 11014 #PBEx_ICMP_Status_Unknown = -1 #PBEx_ICMP_Status_UnrecognizedNextHeader = 11043 CompilerIf #PB_Compiler_Processor = #PB_Processor_x86 PBEx_ICMP = OpenLibrary(#PB_Any, "PB.Ex_ICMP_x86.dll") CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64 PBEx_ICMP = OpenLibrary(#PB_Any, "PB.Ex_ICMP_x64.dll") CompilerEndIf If PBEx_ICMP Prototype SendICMPPing(Address.p-Unicode, Timeout, TTL, DontFragment, ErrorOutput) Global SendICMPPing.SendICMPPing = GetFunction(PBEx_ICMP, "SendICMPPing") Prototype GetICMPStatus(ErrorOutput) Global GetICMPStatus.GetICMPStatus = GetFunction(PBEx_ICMP, "GetICMPStatus") Prototype GetICMPIPAddress(Output, ErrorOutput) Global GetICMPIPAddress.GetICMPIPAddress = GetFunction(PBEx_ICMP, "GetICMPIPAddress") Prototype GetICMPRoundTripTime(ErrorOutput) Global GetICMPRoundTripTime.GetICMPRoundTripTime = GetFunction(PBEx_ICMP, "GetICMPRoundTripTime") Prototype GetICMPTTL(ErrorOutput) Global GetICMPTTL.GetICMPTTL = GetFunction(PBEx_ICMP, "GetICMPTTL") EndIf Global Output$ = Space(1024) Global ErrorOutput$ = Space(128) Define ICMPStatus SendICMPPing("www.google.de", 1000, 128, 1, @ErrorOutput$) ICMPStatus = GetICMPStatus(@ErrorOutput$) If ICMPStatus = #PBEx_ICMP_Status_Success GetICMPIPAddress(@Output$, @ErrorOutput$) Debug "IP address: " + Output$ Debug "Time needed: " + GetICMPRoundTripTime(@ErrorOutput$) Debug "TTL: " + GetICMPTTL(@ErrorOutput$) Else Debug "ICMP-Error: " + ICMPStatus EndIf CloseLibrary(PBEx_ICMP) ; IDE Options = PureBasic 5.60 (Windows - x64) ; CursorPosition = 53 ; FirstLine = 7 ; EnableXP ; EnableUser ; Executable = PB.Ex_MSSQL.exe ; CompileSourceDirectory ; EnableCompileCount = 790 ; EnableBuildCount = 7 ; EnableUnicode