Discussion:
PING command
(too old to reply)
pingman
2006-01-05 10:51:56 UTC
Permalink
Hey Guys!
I am working on the PING command.
I want to know how to set the PING options from s CLI.
Options are: PING_OPT_SILENT
PING_OPT_DONTROUTE
PING_OPT_NOHOST
PING_OPT_DEBUG
also i want to the following:
1. change the size of the ICMP echo packet from CLI (i want to know
how to alter
_pingTXLen).

2. change the _pingTxInterval default value
3. change the _pingTxInterval.

The solution is urgently required.

Karthik Kumar Armugam,
Software Engineer,
Flextronics Software Systems.
***@future.futsoft.com
+91-9382809634
Steve
2006-01-05 21:34:00 UTC
Permalink
Post by pingman
I want to know how to set the PING options from s CLI.
Options are: PING_OPT_SILENT
PING_OPT_DONTROUTE
PING_OPT_NOHOST
PING_OPT_DEBUG
These are defined in pingLib.h. Pass them as the third argument to
ping()

ping("host", numPackets, options)
Post by pingman
1. change the size of the ICMP echo packet from CLI (i want to know
how to alter
_pingTXLen).
2. change the _pingTxInterval default value
3. change the _pingTxInterval.
_pingTXLen and _pingTxInterval are global variables. You can set them
from the shell like any other variable.
--
Steve
pingman
2006-01-06 06:13:54 UTC
Permalink
Dear Steve,
Thanks for your reply.

I am very new to VxWorks.
Also i am very very new to Programming.

May be i did not phrase my question correctly.

My problem:
When i go to the Vx WOrks Command prompt and type : ->ping "localhost",
5 (enter)
the output is 5 pings as expected. I am able to pass the first two
arguments from shell without any problems. I dont know how to pass the
3rd argument i.e. Options parameter from shell.
the options are # defined as below:-
#define PING_OPT_SILENT 0x1 /* work silently */
#define PING_OPT_DONTROUTE 0x2 /* dont route option */
#define PING_OPT_DEBUG 0x4 /* print debugging messages */
#define PING_OPT_NOHOST 0x8 /* dont do
host lookup */


how 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).

Also i want to know the ping command to change the Ping Packet length,
ping packet interval, ping timeout.
Steve
2006-01-06 16:34:55 UTC
Permalink
Post by pingman
how 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 pingman
Also 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
pingman
2006-01-09 05:57:18 UTC
Permalink
thanks Steve :)
u have been so helpful.
cheers!
Karthik Kumar Armugam,
Flextronics Software Systems.

Continue reading on narkive:
Loading...