Post by pingmanhow do i select the above options from the command line? I mean i need
the command syntax to select ping options.
For eg., can i type : ping "localhost",5,1 and expect suppressed
ping output(PING_OPT_SILENT option).
Exactly. For PING_OPT_SILENT with two packets:
-> ping("myhost",2,0x1)
value = 0 = 0x0
For PING_OPT_DEBUG with two packets:
-> ping("myhost",2,0x4)
PING myhost (192.168.1.2): 56 data bytes
64 bytes from myhost (192.168.1.2): icmp_seq=0. time=0. ms
64 bytes from myhost (192.168.1.2): icmp_seq=1. time=0. ms
----myhost PING Statistics----
2 packets transmitted, 2 packets received, 0% packet loss
round-trip (ms) min/avg/max = 0/0/0
value = 0 = 0x0
Note, "myhost" must already be in the host table. See hostAdd().
Post by pingmanAlso i want to know the ping command to change the Ping Packet length,
ping packet interval, ping timeout.
Just set the value of the appropriate global variable before calling ping.
Change the packet size to 32 (from default of 64) and then call ping
with 2 packets and no options:
-> _pingTxLen=32
_pingTxLen = 0xb0be4: value = 32 = 0x20 = ' '
-> ping("myhost",2,0x0)
PING myhost (192.168.1.2): 24 data bytes
32 bytes from myhost (192.168.1.2): icmp_seq=0. time=0. ms
32 bytes from myhost (192.168.1.2): icmp_seq=1. time=0. ms
----myhost PING Statistics----
2 packets transmitted, 2 packets received, 0% packet loss
round-trip (ms) min/avg/max = 0/0/0
value = 0 = 0x0
Same method with _pxTxInterval and _pingTxTmo (or any other global
variable). You can see what the value of the variable is by entering it
on the command line with no arguments (the command line shell is
basically a C interpreter), and assign it a new value with
variable=value statements:
-> _pingTxInterval
_pingTxInterval = 0xb0be8: value = 1 = 0x1
-> _pingTxInterval=2
_pingTxInterval = 0xb0be8: value = 2 = 0x2
-> _pingTxInterval
_pingTxInterval = 0xb0be8: value = 2 = 0x2
-> _pingTxInterval=1
_pingTxInterval = 0xb0be8: value = 1 = 0x1
-> _pingTxInterval
_pingTxInterval = 0xb0be8: value = 1 = 0x1
-> _pingTxTmo
_pingTxTmo = 0xb0bec: value = 5 = 0x5
The first number in the response (e.g. 0xb0be8) is the address of the
variable. Then after the ':' is the value of the variable which is what
you are concerned with here. The value is displayed in decimal and
hexidecimal notation.
--
Steve