Question
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:
- Accept either a URL or an IP address as an input.
- Ping the requested server 3 times instead of once.
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started