Remove dependency on ctype

Also remove range check, if they are passing any number after localhost they obviously aren't passing a file socket.