PING command - VxWorks

This is a discussion on PING command - VxWorks ; 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 ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: PING command

  1. PING command

    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.
    karthikka@future.futsoft.com
    +91-9382809634


  2. Re: PING command

    In article <1136458316.899029.258570@g49g2000cwa.googlegroups. com>,
    pingman wrote:
    >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)

    > 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


  3. Re: PING command

    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.


  4. Re: PING command

    In article <1136528034.611683.142940@z14g2000cwz.googlegroups. com>,
    pingman wrote:
    >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().

    >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

  5. Re: PING command

    thanks Steve
    u have been so helpful.
    cheers!
    Karthik Kumar Armugam,
    Flextronics Software Systems.


+ Reply to Thread