Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Project There are two files, PingProgram.docx and GetHostByName.docx. PingProgram needs an IP address to work, and doesn't use URLs, as per the example below.

Programming Project 

There are two files, PingProgram.docx and GetHostByName.docx. PingProgram needs an IP address to work, and doesn't use URLs, as per the example below. GetHostByName will return an IP address given a URL, also shown below. GetHostByName takes in a URL and a port number.

Rewrite PingProgram to do the following:

  1. Accept either a URL or an IP address as an input.
  2. Ping the requested server 3 times instead of once.
  3. Present all 3 round trip times, along with an average round trip time.



PingProgram example:

PS C:\Users\STARID\source\repos\PingProgram\Debug> .\PingProgram cnn.com

usage: C:\Users\STARID\source\repos\PingProgram\Debug\PingProgram.exe IP address

PS C:\Users\STARID\source\repos\PingProgram\Debug> .\PingProgram 151.101.129.67                                              Sent icmp message to 151.101.129.67

        Received 1 icmp message response

        Information from this response:

          Received from 151.101.129.67

          Status = 0

          Roundtrip time = 31 milliseconds

 

GetHostByName example:

PS C:\Users\STARID\source\repos\GetHostByName\Debug> .\GetHostByName cnn.com 0

Calling getaddrinfo with following parameters:

        nodename = cnn.com

        servname (or port) = 0

 

getaddrinfo returned success

getaddrinfo response 1

        Flags: 0x0

        Family:

        : 2AF_INET (IPv4)

        IPv4 address 151.101.129.67

        Socket type: SOCK_STREAM (stream)

        Protocol: IPPROTO_TCP (TCP)

        Length of this sockaddr: 16

        Canonical name: (null)

getaddrinfo response 2

        Flags: 0x0

        Family:

        : 2AF_INET (IPv4)

        IPv4 address 151.101.193.67

        Socket type: SOCK_STREAM (stream)

        Protocol: IPPROTO_TCP (TCP)

        Length of this sockaddr: 16

        Canonical name: (null)

getaddrinfo response 3

        Flags: 0x0

        Family:

        : 2AF_INET (IPv4)

        IPv4 address 151.101.1.67

        Socket type: SOCK_STREAM (stream)

        Protocol: IPPROTO_TCP (TCP)

        Length of this sockaddr: 16

        Canonical name: (null)

getaddrinfo response 4

        Flags: 0x0

        Family:

        : 2AF_INET (IPv4)

        IPv4 address 151.101.65.67

        Socket type: SOCK_STREAM (stream)

        Protocol: IPPROTO_TCP (TCP)

        Length of this sockaddr: 16

        Canonical name: (null)



Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Computer Network questions

Question

What is the typical class size?

Answered: 1 week ago