What is the most appropriate data type for storing an IP address in SQL server? [duplicate]

Storing an IPv4 address as a binary(4) is truest to what it represents, and allows for easy subnet mask-style querying. However, it requires conversion in and out if you are actually after a text representation. In that case, you may prefer a string format. A little-used SQL Server function that might help if you are … Read more

How do I choose a multicast address for my application’s use?

It seems you’ve already found http://www.iana.org/assignments/multicast-addresses, so you’ve done the right thing by picking an address from the 239.255/16 range. As those ranges are entirely for site-local use it’s no ones else’s business which particular address you pick, but you may need to coordinate with the network manager (assuming that’s not you) to pick an … Read more

How to convert an IPv4 address into a integer in C#?

32-bit unsigned integers are IPv4 addresses. Meanwhile, the IPAddress.Address property, while deprecated, is an Int64 that returns the unsigned 32-bit value of the IPv4 address (the catch is, it’s in network byte order, so you need to swap it around). For example, my local google.com is at 64.233.187.99. That’s equivalent to: 64*2^24 + 233*2^16 + … Read more

What is IPV6 for localhost and 0.0.0.0?

As we all know that IPv4 address for localhost is 127.0.0.1 (loopback address). Actually, any IPv4 address in 127.0.0.0/8 is a loopback address. In IPv6, the direct analog of the loopback range is ::1/128. So ::1 (long form 0:0:0:0:0:0:0:1) is the one and only IPv6 loopback address. While the hostname localhost will normally resolve to … Read more

Validating IPv4 addresses with regexp

Best for Now (43 chars) ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$ This version shortens things by another 6 characters while not making use of the negative lookahead, which is not supported in some regex flavors. Newest, Shortest, Least Readable Version (49 chars) ^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$ The [0-9] blocks can be substituted by \d in 2 places – makes it a bit less … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)