Question

In: Computer Science

c programming Proxy IP addresses and port number are following [Ref-1] 191.96.43.58:3129 136.25.2.43:49126 198.211.96.170:3129 198.1.122.29:80 Note:...

c programming

Proxy IP addresses and port number are following [Ref-1]

191.96.43.58:3129

136.25.2.43:49126

198.211.96.170:3129

198.1.122.29:80

Note: THE STRING FORMATE IS "IP_Address:Port_Number ". For example, "191.96.43.58:3129" includes an IP address and a port number. "191.96.43.58" is the IP address; "3129" is the port number.

Write a program using C Structures.

If port number is 3129, please identify these IP addresses.

Solutions

Expert Solution

#include <stdio.h>
//structure declaration
struct IPAddress
{
char *address;
char *port;
};

int main()
{
//variable declaration
int i=0;
struct IPAddress ip[5];
ip[0].address = "191.96.43.58";
ip[0].port = "3129";
ip[1].address = "136.25.2.43";
ip[1].port = "49126";
ip[2].address = "198.211.96.170";
ip[2].port = "3129";
ip[3].address = "198.1.122.29";
ip[3].port = "80";
//display ip address
for(i=0; i<5; i++)
{
if(ip[i].port == "3129")
printf("%s\n", ip[i].address);
}
return 0;
}

OUTPUT:

191.96.43.58                                                                                                                  

198.211.96.170


Related Solutions

1) Windows Powershell: Maps IP addresses to MAC addresses. Maps IP addresses to MAC addresses. Run...
1) Windows Powershell: Maps IP addresses to MAC addresses. Maps IP addresses to MAC addresses. Run arp /? What does the command show? 2) Ping is used to test the ability of one network host to communicate with another. Run: ping cnn.com or ping yahoo.com or ping facebook.com write down the results
Implement the following in Classless IP Addressing in C programming using decimal number system (a) Compute...
Implement the following in Classless IP Addressing in C programming using decimal number system (a) Compute First Address, Last address and Number of address from given IP address and mask. Input is given by the user
Instructions: Using Unix programming language and regular expressions, 1. how many unique ip addresses were seen...
Instructions: Using Unix programming language and regular expressions, 1. how many unique ip addresses were seen note: we only want to look at ipv4 addresses 2. which was most commnly seen ip address on the piece of access.log file below 66.249.75.132 - - [18/Jun/2018:06:41:00 -0500] "GET /~rcoleman/Common/History/Images/?C=N;O=D HTTP/1.1" 200 1976 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" 5.255.250.23 - - [18/Jun/2018:06:41:23 -0500] "GET /~rcoleman/Common/CodeVault/Code/DesignPatterns/Images/DP16-Builder.jpg HTTP/1.1" 304 182 "-" "Mozilla/5.0 (compatible; YandexImages/3.0; +http://yandex.com/bots)" 5.255.250.23 - - [18/Jun/2018:06:41:28 -0500] "GET /~rcoleman/CS121/CourseInfo/Images/WinExp.jpg HTTP/1.1" 304 180...
Programming in C++ Write a program that prints the values in an array and the addresses...
Programming in C++ Write a program that prints the values in an array and the addresses of the array’s elements using four different techniques, as follows: Array index notation using array name Pointer/offset notation using array name Array index notation using a pointer Pointer/offset notation using a pointer Learning Objectives In this assignment, you will: Use functions with array and pointer arguments Use indexing and offset notations to access arrays Requirements Your code must use these eight functions, using these...
Programming In C Write a program that prints the values in an array and the addresses...
Programming In C Write a program that prints the values in an array and the addresses of the array’s elements using four different techniques, as follows: Array index notation using array name Pointer/offset notation using array name Array index notation using a pointer Pointer/offset notation using a pointer Learning Objectives In this assignment, you will: Use functions with array and pointer arguments Use indexing and offset notations to access arrays Requirements Your code must use these eight functions, using these...
C PROGRAMMING Identify and correct the errors in each of the following. [Note: There may be...
C PROGRAMMING Identify and correct the errors in each of the following. [Note: There may be more than one error in each piece of code.] a) if ( sales => 5000 ) puts( "Sales are greater than or equal to $5000" ) else puts( "Sales are less than $5000 ) b) int x = 1, product = 0; while ( x <= 10 ); { product *= x; ++x; } c) While ( x <= 100 ) total =+ x;...
1) Suppose we have the following IP addresses for two different organizations, we have to create...
1) Suppose we have the following IP addresses for two different organizations, we have to create 5 networks having 30 hosts in it. Find first sub network ID, Fist address, Last address and Broadcast for each of the following given addresses? a) 14.23.120.8 b) 252.5.15.111
For the following classess IP addresses, identify what the ned id and the host id are...
For the following classess IP addresses, identify what the ned id and the host id are 119.120.231.15/12 11.30.125.141/17 244.192.168.10/18 199.10.155.121/28
Instructions Write a Client/Server application to do the following​ Client​ Take in IP address and Port...
Instructions Write a Client/Server application to do the following​ Client​ Take in IP address and Port as command line arguments​ Connect to Server​ Start "infinite loop"​ Take in message from command line​ Convert it to the packet form from last lab​ Instead of an array, store packet in a char array (string) so it can be easily sent​ Print out packet to terminal​ Send packet to server​ Print out reply from server End "infinite loop" Server Create connection on the...
Instructions Write a Client/Server application to do the following​ Client​ Take in IP address and Port...
Instructions Write a Client/Server application to do the following​ Client​ Take in IP address and Port as command line arguments​ Connect to Server​ Start "infinite loop"​ Take in message from command line​ Convert it to the packet form from last lab​ Instead of an array, store packet in a char array (string) so it can be easily sent​ Print out packet to terminal​ Send packet to server​ Print out reply from server End "infinite loop" Server Create connection on the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT