08-12-2014 04:50 PM
I'm trying to write a program to use the system configuration vi's for my real time units (sbRio 9602). When I'm trying to set the hostname it throws an error -2147220614 which is an illegal character in the host name, but funny thing I could set the hostname with the only api's in labview 2011.
The hostname I'm trying to set is TS1.5, which I can use my old app and set it to that hostname, so, not for sure why it doesn't work here. This is just an example, seems like lots of stuff you would think would work doesn't.
I am using LV 2012 sp1.
Thanks,
Eric.
Solved! Go to Solution.
08-12-2014 04:55 PM
I'd guess that the period isn't allowed in a host name. That is normally just used in the TCP/IP address.
08-13-2014 08:25 AM
crossrulz is right. Dots are only allowed in host names as domain and/or subdomain separators. The RFC 952 standard will only allow alpha-numeric characters (A-Z, 0-9) or hyphens ( - , not underscore) in host names.
http://support.microsoft.com/kb/122900
tools.ietf.org/html/rfc952
I am not sure why you were able to use dots before, but definitely, the error message is expected.
08-13-2014 08:55 AM
Cavarval, thanks for that reply, I was looking to see what the "rules" really were. What about spaces, I'm assuming those are not allowed as well.
08-13-2014 09:13 AM
Right assumption, spaces are not allowed either.
08-16-2014 11:40 PM
Ok, a slight follow up to the original question. Don't know if it is more appropiate to post a new one or not, but it is directly related. I'm trying to validate the hostname before calling the function but I can't seem to figure out the match pattern vi. Basically I need to verify the string only has A-Z, a-z, 0-9, and the - char. How can I use the match pattern to do that?
08-18-2014 10:41 AM
The idea is alright, but there are several things you need to change.
The Match Pattern function is currently looking a pattern in the form of one character from [A-Z], followed by one character from [a-z], followed by one character from [0-9], followed by a hyphen, somewhere in the string; that is [A-Z] AND [a-z] AND [0-9] AND [-]. So, first you need to change the regular expression from [A-Z][a-z][0-9][-] to [A-Za-z0-9"-"], so it will look for [A-Z] OR [a-z] OR [0-9] OR [-].
Also, the function only "iterates once", so it returns only the first character on [A-Za-z0-9"-"]. Basically, using a loop and the String Length to set the iterations count will do the trick.
If you still can't get it working, I would suggest you to create a new post about it.
P.D: you can in fact match a multi-character pattern match, but you need to know exactly what you are looking for. For example, if your string is "Test abc1 String", and you want to extract any combination of three lowercase letters and one number, you can use [a-z][a-z][a-z][1] you will get "abc1". However, in your particular case the approach I suggested above should be easier.