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
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...
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;...
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...
C++ Programming level 1 using step number 2 is a must Guess the Number Introduction In...
C++ Programming level 1 using step number 2 is a must Guess the Number Introduction In this assignment you will create a program that will simulate a number guessing game. Skills: random, while-loop, Boolean flags Algorithm to win The guess the number game has an algorithm to lead to the winning value. The way it works is say you have the set of numbers 1 to 100. You always begin by choosing the half-way point, then a hint will be...
Note: I need a code and other requirement Note: programming language is c++ If you need...
Note: I need a code and other requirement Note: programming language is c++ If you need more information, please clarify what information you want. consider solving the equation sin(x) - e^(-x) = 0 write a computer program to solve the given equation using: 1- bisection method 2- fixed-point method 3- newton's intervals: {0,1},{1,2},{2,3},{3,4},{4,5},{5,6},{6,7},{7,8},{8,9},{9,10} choose accuracy E = 10^(-5) Make sure you document your program Requirement : 1- Mathematical justification 2- algorithem description 3- code (program) with documentation 4-output: roots ,...
C programming review excerises. 1. Write a function that counts the number of lines in a...
C programming review excerises. 1. Write a function that counts the number of lines in a file, using the following declaration: int countLines(char *filename) 2. Write a program that counts the number of words in a text file. Use the command-line arguments to read the name of the file. The syntax: countwords filename.txt 3. Write a program that counts the number of words starting with the first letter ‘T’ in a text file. Using commend line argument for the text...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT