Page 1 of 2
IP Address validation
Posted: 03 Jan 2011 16:14
by grsychckn
I use a lot of IP addresses to access shares. It would be nice if you could implement a sanity check on the text before attempting to connect to the network share. As machine names can't contain '.', this should be a straight-forward check to ensure the IP address is even possible. I have on occasion typed in an IP such as: \\192.168.1.1234 and have to wait for xyplorer (windows explorer) to discover there are no machines with that IP when all it needed to do was validate that 1234 was not a valid fourth octet.
Thanks!
Re: IP Address validation
Posted: 03 Jan 2011 16:42
by admin
Good idea. Are there more rules apart from the "."?
Re: IP Address validation
Posted: 03 Jan 2011 16:53
by nas8e9
admin wrote:Good idea. Are there more rules apart from the "."?
Perhaps (optionally) limiting input to local IP addresses (10.x.x.x., 172.16.x.x / 172.31.x.x, 192.168.x.x)?
All numbers (for both local and global addresses) should of course be between 0 and 255.
Reference:
http://en.wikipedia.org/wiki/IP_address
Re: IP Address validation
Posted: 03 Jan 2011 17:07
by grsychckn
Although I'm entirely sure what is an invalid character for a computer name, I believe valid characters are A-Z, 0-9, and '-'. I could be wrong on that. To validate an IP address, check out the following link:
http://www.dreamincode.net/code/snippet1378.htm .
Thanks again.
Re: IP Address validation
Posted: 03 Jan 2011 18:14
by mwb1100
grsychckn wrote:As machine names can't contain '.'
Who says machine names can't contain '.' ? Windows has supported fully qualified domain names since at least Win2k. You're not necessarily stuck with netbios names anymore.
Re: IP Address validation
Posted: 03 Jan 2011 18:18
by admin
What situation are we talking about? Typing into the Address Bar, or actually ENTER-ring an address throught the address bar?
Re: IP Address validation
Posted: 03 Jan 2011 18:32
by mwb1100
admin wrote:What situation are we talking about? Typing into the Address Bar, or actually ENTER-ring an address throught the address bar?
Are you asking in response to my post? If so, I don't understand what you're asking about.
Re: IP Address validation
Posted: 03 Jan 2011 18:34
by admin
mwb1100 wrote:admin wrote:What situation are we talking about? Typing into the Address Bar, or actually ENTER-ring an address throught the address bar?
Are you asking in response to my post? If so, I don't understand what you're asking about.
No, sorry for the confusion. This was meant as a reply to the original post. When I said "Good idea" I was probably thinking in a wrong direction. I need to clarify what the OP really is talking about.
Re: IP Address validation
Posted: 03 Jan 2011 19:47
by grsychckn
Ok, I guess I need to clarify my exact scenario. I want to access a share via IP to machine 192.168.1.120. In the address bar of xyplorer I type in '\\192.168.1.1290' and hit enter. I now have to wait for windows to reach that machine before I can edit the address bar to correct my mistake.
Regardless of if Windows supports fully-qualified domain names, there should still be a very simple set of logical rules that can be derived and applied to validate the IP address of a location you type into the address bar before the location is actually resolved. It's not a fequent problem, but I have fat fingers and it is quite annoying. I would prefer xyplorer to give me the option to validate addresses before I hit enter so that I don't get stuck waiting on windows to try and contact an IP address that isn't even possible to exist. This has annoyed me for years...
Thanks
Edit: I'm specifically referring to accessing windows file shares by IP. I do not access file shares by machine name as we have 3 different networks and the IP schema is how we organized specific blocks of servers so I perform almost all of my windows file share browsing by IP address.
Re: IP Address validation
Posted: 03 Jan 2011 19:51
by admin
grsychckn wrote:Ok, I guess I need to clarify my exact scenario. I want to access a share via IP to machine 192.168.1.120. In the address bar of xyplorer I type in '\\192.168.1.1290' and hit enter. I now have to wait for windows to reach that machine before I can edit the address bar to correct my mistake.
Regardless of if Windows supports fully-qualified domain names, there should still be a very simple set of logical rules that can be derived and applied to validate the IP address of a location you type into the address bar before the location is actually resolved. It's not a fequent problem, but I have fat fingers and it is quite annoying. I would prefer xyplorer to give me the option to validate addresses before I hit enter so that I don't get stuck waiting on windows to try and contact an IP address that isn't even possible to exist. This has annoyed me for years...
Thanks
Ok, I see.
Now is it really impossible that a computer is
named "192.168.1.1290" ? Probably a Computer name has to begin with a letter (?)... Anybody knows where to find the specification?
Re: IP Address validation
Posted: 03 Jan 2011 20:05
by grsychckn
admin wrote:grsychckn wrote:Ok, I guess I need to clarify my exact scenario. I want to access a share via IP to machine 192.168.1.120. In the address bar of xyplorer I type in '\\192.168.1.1290' and hit enter. I now have to wait for windows to reach that machine before I can edit the address bar to correct my mistake.
Regardless of if Windows supports fully-qualified domain names, there should still be a very simple set of logical rules that can be derived and applied to validate the IP address of a location you type into the address bar before the location is actually resolved. It's not a fequent problem, but I have fat fingers and it is quite annoying. I would prefer xyplorer to give me the option to validate addresses before I hit enter so that I don't get stuck waiting on windows to try and contact an IP address that isn't even possible to exist. This has annoyed me for years...
Thanks
Ok, I see.
Now is it really impossible that a computer is
named "192.168.1.1290" ?
Good question. Though mwb1100 says windows supports fully-qualified names, the following shows that the machine name itself cannot contain '.' in a windows environment. The FQDN may contain a '.', but the machine name by itself cannot have a '.' in it.
http://technet.microsoft.com/en-us/libr ... 59336.aspx
Correct me if I'm wrong but this means that if there is a-z or A-Z or a '-' in the address bar, it is safe to assume the user is trying to access by machine name, otherwise it it either all digits or digits with a '.' to separate the octets. If the '.' was put in by accident, it wouldn't validate anyway as you'd need 3 '.'s for a valid IP.
Brian
Re: IP Address validation
Posted: 03 Jan 2011 20:26
by admin
grsychckn wrote:admin wrote:grsychckn wrote:Ok, I guess I need to clarify my exact scenario. I want to access a share via IP to machine 192.168.1.120. In the address bar of xyplorer I type in '\\192.168.1.1290' and hit enter. I now have to wait for windows to reach that machine before I can edit the address bar to correct my mistake.
Regardless of if Windows supports fully-qualified domain names, there should still be a very simple set of logical rules that can be derived and applied to validate the IP address of a location you type into the address bar before the location is actually resolved. It's not a fequent problem, but I have fat fingers and it is quite annoying. I would prefer xyplorer to give me the option to validate addresses before I hit enter so that I don't get stuck waiting on windows to try and contact an IP address that isn't even possible to exist. This has annoyed me for years...
Thanks
Ok, I see.
Now is it really impossible that a computer is
named "192.168.1.1290" ?
Good question. Though mwb1100 says windows supports fully-qualified names, the following shows that the machine name itself cannot contain '.' in a windows environment. The FQDN may contain a '.', but the machine name by itself cannot have a '.' in it.
http://technet.microsoft.com/en-us/libr ... 59336.aspx
Correct me if I'm wrong but this means that if there is a-z or A-Z or a '-' in the address bar, it is safe to assume the user is trying to access by machine name, otherwise it it either all digits or digits with a '.' to separate the octets. If the '.' was put in by accident, it wouldn't validate anyway as you'd need 3 '.'s for a valid IP.
Brian
That sounds okay, but... I should be careful when basing decisions on such name standards that are not mine. They might change, or there might be obscure exceptions. The question is: if there are clear-cut ways to tell a possible from an impossible name, why isn't the Windows API clever enough to avoid trying to connect to an impossible name? I'd rather outsource the smartness to Windows (and to you and your fingers

).
Re: IP Address validation
Posted: 03 Jan 2011 22:51
by grsychckn
admin wrote:
That sounds okay, but... I should be careful when basing decisions on such name standards that are not mine. They might change, or there might be obscure exceptions. The question is: if there are clear-cut ways to tell a possible from an impossible name, why isn't the Windows API clever enough to avoid trying to connect to an impossible name? I'd rather outsource the smartness to Windows (and to you and your fingers

).
Haha - If Microsoft could make a useful file explorer GUI, why do I want to use xyplorer? They can't get it right to save their soul and in Windows 2008 (I'm using), I've been very tempted to re-write my own file explorer using something other than the system libraries because it plain sucks.
Couldn't we even compromise by allowing a button or additional/optional address bar that would auto-validate after I type in an address? Even a simple dialog separate from the existing address bar...
If not, I'll have to live with it - been years, so what's a few more? Thanks for opening it up for discussion though.
Re: IP Address validation
Posted: 03 Jan 2011 23:06
by mwb1100
grsychckn wrote:Though mwb1100 says windows supports fully-qualified names, the following shows that the machine name itself cannot contain '.' in a windows environment. The FQDN may contain a '.', but the machine name by itself cannot have a '.' in it.
http://technet.microsoft.com/en-us/libr ... 59336.aspx
That article indicates that even a netbios name can contain a dot:
NetBIOS: Unicode characters, numbers, white space, symbols: ! @ # $ % ^ & ' ) ( . - _ { } ~
I'm not sure how often you'll run across such a thing, but know that I've run into validation schemes at times that declare my valid entry as being bogus and provide no way to just go ahead and let me put what I want anyway (this happens with email addresses occasionally). I find that situation very frustrating, so I'd warn Don to not potentially put a user in a corner like that.
I think a sanity check for a string that looks like it should be an IP address but isn't might make sense. However, I'd suggest trying to do it in a way that if the user really wants to put "10.10.1000.10" or whatever into the address bar, he can (without too much trouble).
Another approach to the problem might be to make the resolution of the address in the address bar cancellable. But that probably involves spinning up a thread to do the resolution which opens its own can of worms.
Re: IP Address validation
Posted: 03 Jan 2011 23:07
by PeterH
OK: first question is: address or name.
If it's an address it could be checked if correct.
Bad, if a non-correct address would mean it's a name...