Creating a PING PROGRAM help??

This is a discussion on Creating a PING PROGRAM help?? within the C++ Programming forums, part of the General Programming Boards category; Okay so I have got part of it but like parts are missing that would be interesting or hand to ...

  1. #1
    adn
    adn is offline
    Registered User
    Join Date
    Feb 2008
    Posts
    2

    Creating a PING PROGRAM help??

    Okay so I have got part of it but like parts are missing that would be interesting or hand to know how to do. So like what I am looking for is a ping program with commands or possibly a windows and you type in the remote address and the size of the packet you will send. I have gotten this far can anyone help me?

    Code:
    #include<windows.h>
    int main()
    {
    system("ping host address");
    return 0;
    }

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,424
    you have several steps to do
    1. create a fucntion that will send a request
    2. for now - you can use you system approach
    3. you will use sprintf to form a command
    [code]
    char buffer[1024];
    sprintf(buffer,"ping &#37;s -l %d > res.txt", hostname, size);
    system(buffer);
    4. and other function that will parse the res.txt file to present the result

    5. After that you can build simple GUI program that will use these 2 functions
    6. After that you can switch to using winsock2 library and create ping packet directly and process the response in a proper way
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3

  4. #4
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059

  5. #5
    adn
    adn is offline
    Registered User
    Join Date
    Feb 2008
    Posts
    2
    Quote Originally Posted by carlorfeo View Post
    That doesn't however address the issue of being able to change the packet size. Which seem s to be the hardest and most confusing.

  6. #6
    coder
    Join Date
    Feb 2008
    Posts
    127
    Yes, I linked that just to give you an example to start from.
    You will need to set the correct "ping" option to manage the packet length.
    In a Linux terminal <man ping> will display the command's manual. I have no clue about windows.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  2. insufficient memory for tsr
    By manmohan in forum C Programming
    Replies: 8
    Last Post: 01-02-2004, 08:48 AM
  3. Date program starts DOS's date
    By jrahhali in forum C++ Programming
    Replies: 1
    Last Post: 11-24-2003, 04:23 PM
  4. creating a simple program to accept a password.
    By boy1015 in forum C++ Programming
    Replies: 11
    Last Post: 02-05-2002, 07:34 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21