how many machines can actually be connected on the internet using IPV4? [closed] - ipv4

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Recently we were talking about IP addresses running out. I was wondering how many machines can we connect on the internet before IP addresses run out. My calculation went something like this.
Class A - 2 ^ 31 (7 bits Network Id + 24 bits Host Id.)
Class B - 2 ^ 30 (14 bits Network Id + 16 bits Host Id.)
Class C - 2 ^ 29 (21 bits Network Id + 8 bits Host Id.)
Class D - 2 ^ 28 (28 bits multicast group Id.)
Class E - 0 Reserved for future use.
So the total number of machines that is allowed on the internet should be
2^31 + 2^30 + 2^29 + 2^28 = 2^28(1 + 2 + 4 + 8) = 15 * 2^28.
Does this calculation seem correct?

Technically, you can have infinite clients, but only roughly 255*255*255*243 servers. This is because a client connects to a server so the server must have a direct IP, but when a server responds, the router knows which client sent the request so it can direct it appropriately.
So your real question is, how many SERVERS (accepting incoming connections) can you have, for which your calculation is correct.

Related

how to understand tcpdump particular field field [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 days ago.
Improve this question
I have below two tcpdump, Want to know what are "syslog.info" and "local6.info" column meaning? and what are the representation of syslog.info and local6.info
06:56:07.533143 IP 10.10.40.10.52126 > 10.18.40.58.514: SYSLOG **syslog.info**, length: 189
06:56:07.669902 IP 10.10.40.15.37866 > 10.18.40.58.514: SYSLOG **local6.info**, length: 292
void openlog(const char *ident, int option, int facility); where priority is facility | level. In the string version above facility syslog and local6 corresponds to LOG_SYSLOG and LOG_LOCAL6, and info is the level which corresponds to LOG_INFO. As for semantic:
LOG_SYSLOG: messages generated internally by syslogd(8)
LOG_USER (default): generic user-level messages
LOG_INFO: informational message

Why do prime factors exist only till the square root of number? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 10 months ago.
Improve this question
To find all the prime factors of a number we traverse from 2 to sqrt(number). What makes all the prime factors accommodated within sqrt(number)?
If you express a number as z = x*y, either x or y has to be <=sqrt(z), otherwise the product becomes greater than z
For all (x,y) pairs such that z = x*y, if you traverse x between [2, sqrt(z)], you can cover all y by getting z/x
"What makes all the prime factors accommodated within sqrt(number)". This fact is wrong, a simple counter example is 7 for 28. By using the first two points however, when you test the divisibility of 4 (which is <=sqrt(28)), you get 7 by doing 28/4
Suppose c = a * b. If a | c, then b | c i.e. (c / a) | c.
We leverage this fact to reduce the time complexity to find all the factors of a number.
For example, take the number 12.
Square root of 12 is 3.46 approximately.
1 and 12 (the number itself) are already factors.
So we can iterate from 2 until 3.
Since 12 % 2 is 0, 2 is a factor and 12 / 2 = 6 is also a factor.
12 % 3 is 0, so 3 is a factor and 12 / 3 = 4 is also a factor.
This way, we have found all the factors.
In a sense, we iterate till the multiplicative middle point which lies at the square root for a single number and leverage the above property.
To find all prime factors, we must iterate over prime numbers from 2 until square root of the number.

Octave - How to plot an "infinite"(= Defining the function on [0:35916] for me) sawtooth function [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I know how to plot a sawtooth function (thanks to another forum) but only on the domain [0:10] thanks to the following code which is actually working :
t=0:0.04:10;
A=1;
T=1;
rho= mod(t * A / T, A);
plot(t,rho)
A=the amplitude, T=the period,t=the time interval.
The problem is that I need the same function on the domain [0:35916] but when I try to adapt this code to do so (eg by extending the time interval), I get an error and I don't understand why.
error:
plt2vv: vector lengths must match error: called from plt>plt2vv at line 487 column 5 plt>plt2 at line 246 column 14 plt at line 113 column 17 plot at line 222 column 10
Simply modifying the original upper limit of your interval from 10 to 35916 should do the trick:
t=0:0.04:35916;
A=1;
T=1;
rho= mod(t * A / T, A);
plot(t,rho)
The code above yields the following image:
Of course it is up to you to adjust A and T to suit your needs.

Is it possible / common sense to change a CIDR prefix to meet a certain requirement of a network?

Say for example, you have an IP address with a CIDR prefix of /27 (mask of 255.255.255.224) and are required to create 4 subnets each with an equal amount of usable host addresses, would it be commonplace / accepted to adjust the prefix to /26 (using only 2 additional
bits, leaving 6 for the Host ID) to allow for 4 subnets, each with 62 (60 usable addresses ?
Or
Is just a case of when a prefix is already set (in this case /27) you simply “get what your given” and utilise only 4 of the possible 8 subnets that can be created with the additional 3 bits and have 4 subnets, each with 32 (30 usable addresses)?
I understand the prefix denotes how many bits are considered significant for the network address with the remainder allocated for the host / node.
Thanks in advance, I am quite new to networking but feel like common sense might apply in this case?
I haven to been able to find anything that confirms or denies the possibility of doing this when required.

Java Code Explain [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I got this code somewhere from the internet
final int time = 80 << 3 + 1;
<< is a left shift operator
The signed left shift operator "<<" shifts a bit pattern to the left,
and the signed right shift operator ">>" shifts a bit pattern to the
right. The bit pattern is given by the left-hand operand, and the
number of positions to shift by the right-hand operand.
So 24 << 8 means shift binary value of 24 towards left by 8 bits position.
Follow reference to learn more about it.
24 << 8 means shifting the number 24 to the left for 8 bits, which is equivalent to 24 * (2^8) = 6144.
In the provided code snippet, it encodes a time hh:mm into an integer hh << 8 + mm.
Since there are 24 hours in one day, the array to represent the activity of every minute in one day requires (24 << 8) + 1 elements. The +1 is to make the array index for 24:00 legal.
It means bit-shift the constant integer value 24 left by 8 bits.