I have the following JSP code, that protects my web page and displays it only to know IP's
String ip_h = request.getRemoteAddr();
String host_h = request.getRemoteHost();
String iplist[] = new String[1];
iplist[0] = "127.0.0.1";
iplist[1] = "10.217.106.248";
int count = iplist.length;
boolean flag = false;
int zz = 0;
/...
When a IP-Range is written as aaa.bbb.ccc.ddd/ I need to calculate the first and the last included ip address in this range with C#.
Example:
Input: 192.168.0.1/25
Result: 192.168.0.1 - 192.168.0.126
...
My SQL-Server db stores IP netmasks as binary.
I need a way to match these with a given IP
for example:
is 192.168.21.5 part of a netmask which is stored in the db?
the binary representation of 192.168.21.5:
11000000.10101000.00010101.00000101 (without the dots)
Netmask stored in db is: binary(4) and a tinyint field
11000000.1010100...
I know how to get from ifconfig. (linux)
But is there another way? Can found it in socket.
...