• Post Reply Bookmark Topic Watch Topic
  • New Topic

NX Contractors 2.1.1: Validating Hostname Input

 
Paul Tongyoo
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all--
Is there a valid format for a server's hostname? I'm thinking about using a regular expression to validate input, but what should its restrictions be? .com at the end? Only letters, numbers, and periods allowed?
Thanks in advance,
Paul
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12056
232
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,
I wouldn't try and validate the hostname - there is just too much work involved. There are very few systems that really validate the hostname: what most do is simply try to look up an internet address for that hostname, and if that works, then they use it (which is why so many were upset with Verisign's breaking DNS a month or so ago).
I didn't even go that far with my assignment: whatever the user gave me I used. By default I offered "localhost" as the possible location.
Regards, Andrew
 
Paul Tongyoo
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Andrew -- Paul
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!