Jump to content

Recommended Posts

Posted (edited)

 

hello autoit community,
i would like to share this ping util based on .Net core App domain , which have some more functions than the standard autoit ping , like :-

1- send ping with specified TTL & size & dontfragment flag & time out
2-true multithreading ping (send many ping packets same time) 
3- no 3rd party exe or dll included 

requirements:-
DotNet All

Functions:-
1-$result=_ping($ip[,$timeout,$TTL,$dontfragment,$buffersize]) 
input:-
$ip=(string) can be single ip or array of IP (ping will be sent to all ips in the array on same time)
$timeout=(int) default is 4000
$TTL= (int)  default is 255 
$dontfragment=(bool)  default is false
$buffersize=(int) default is 32
output:-
$result=ping time as single int if $ip was single ip or array of int if $ip was array of ip's ,
$result=0 if host unreachable or offline
$result=-1 if host not exist(bad domain name) or general error

2-_ping_debug($enable)
$enable = (bool) enable debugging output to console , false by default

examples:-

1-MTU example

#include<PingEX.au3>
$ip="8.8.8.8"
$timeout=200
$ttl=200
$dontfragment=true

for $packetsize=1500 to 1480 step -1
    $packetheader=28
    $result=_ping($ip,$timeout,$ttl,$dontfragment,$packetsize-$packetheader)
    if $result>0 Then
    ConsoleWrite("Max allowed packet size without fragmentation is : "&$packetsize &@crlf)
    ExitLoop
    endif
next


2- Multi threading ping:-
 

#include<PingEX.au3>
$codeperformance=TimerInit()
global $IP_list[5]=["192.168.1.1","10.0.0.1","www.google.com","Wrongdomain","192.168.1.1.1.1.1"]
$timeout=1000
$result=_ping($IP_list,$timeout)

for $i=0 to UBound($IP_list)-1
    ConsoleWrite("Pinging "&$IP_list[$i]&" :Result is = "&$result[$i]&@CRLF)
next
ConsoleWrite("Code executed in : "&TimerDiff($codeperformance)&@CRLF)

 

PingEX.au3

Edited by Network_Guy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...