New answers tagged asp.net-mvc
One option would be to use regular expressions: build one regular expression that matches any of the servers (in your case, it would be Server1|Server2|192\.168\.0\.2, you can build that by using something like string.Join("|", servers.Select(Regex.Escape))). Don't forget about the option to compile the regex, which could speed it up significantly.
If your current code is simple and fast enough for your needs, do nothing. Just to optimize because "it seems a bit brute force" is not a good reason, it will mostly complicate things for no benefit. Do not fall into the trap of premature optimization. However, if your current code really is too slow for your purposes, first measure where the bottleneck is. ...
A "connection" isn't much more than a record in a table. As long as both parties have a "plan" for routing packets from each other, the connection is "open." It doesn't require either end to have a dedicated thread "holding the connection open." It just requires that end party have sufficient information to route and process packets received from the other ...
Top 50 recent answers are included