Open tywald opened 7 years ago
Yeah we should strip spaces as a very minimum.
Would it be safe to check if a connection can be made to the server the ip points to? (invalid ip addresses) The only way I know is to connect to it (will actually connect and drop a client from the server).
Since DNS can be used, I don't think syntax checks makes sense, and you might maybe want to be able to change the address while offline so I don't like the idea of such checks either, but I'm adding whitespace stripping.
I think you misunderstood what I was trying to say. A green bubble next to the ip you entered would signal that the server could be reached. A red bubble next to the ip you entered would signal connection failed.
Currently you can type whatever you want, it would be nice to have some checks to see if it's valid or not.
A very overlooked issue when the IP isn't working is if it the user accidently added a space at the beginning or at the end of the address, making it hard to spot right away. Usually caused by not paying attention during copy-paste: i.e copy-paste " 192.168.1.2" or "192.168.1.2 " (without quotes).
If the user copy-pastes the address or typing it manually, the emulator should tell the user if the IP is valid or not so they can correct it.
Might be a bit complicated when it comes to domain names though like coldbird.net
A lazy fix would be just to check for spaces and prevent them from being typed and remove them during copy-paste. At least in that case you can see more easily if there is a typo somewhere.