Code review#1
Conversation
|
Add readme.md on how application should be used, |
| using System.Text.RegularExpressions; | ||
| using System.Diagnostics; | ||
|
|
||
| namespace Connectivity_Tester |
There was a problem hiding this comment.
CamelCase, no underscores
| Console.WriteLine($"\t\tSupports IPv6: {networkInterface.Supports(System.Net.NetworkInformation.NetworkInterfaceComponent.IPv6)}"); | ||
|
|
||
| Console.WriteLine("\t\tUnicast address list:"); | ||
| if (properties.UnicastAddresses.Count == 0) |
There was a problem hiding this comment.
Here the count is checked then iterated, can it be done by just iterating UnicastAddresses ?
|
|
||
| Console.WriteLine($"\t{host} resolved to:"); | ||
|
|
||
| if (entry.AddressList.Length == 0) |
There was a problem hiding this comment.
Same as above here, no need to check count if foreach will be used.
|
|
||
| public static IPAddress[] TestSubnetConnectivity(string subnetAddressPrefix, int port, IPAddress[] resolvedAddresses = null) | ||
| { | ||
| string[] split = subnetAddressPrefix.Split('.', '/'); |
There was a problem hiding this comment.
Please add comments of what is done here
| ip[2]++; | ||
| ip[3] = 0; | ||
| } | ||
| else |
|
|
||
| var sucConnections = new LinkedList<IPAddress>(); | ||
|
|
||
| for (int i = 0; i < (int)Math.Pow(2, 32 - mask); i++) |
There was a problem hiding this comment.
Comment what is done here
| asyncResults.Add(client, ipAddress); | ||
| client.BeginConnect(ipAddress, port, null, null); | ||
|
|
||
| if ((i + 1) % 16777216 == 0) |
Added README.md
| { | ||
| static class ConnectivityTester | ||
| { | ||
| private const double TimeLimitSeconds = 10.0; |
There was a problem hiding this comment.
Add cli argument for these constants so that user can change these parameters.
| Console.WriteLine($"\t\tInterface description: {networkInterface.Description}"); | ||
| Console.WriteLine($"\t\tInterface type: {networkInterface.NetworkInterfaceType}"); | ||
| Console.WriteLine($"\t\tOperational status: {networkInterface.OperationalStatus}"); | ||
|
|
|
|
||
| Console.WriteLine("\t\tDNS server address list:"); | ||
|
|
||
| foreach (var address in properties.DnsAddresses) |
There was a problem hiding this comment.
This is just suggestion to try using JOIN instead of foreach loops.
https://docs.microsoft.com/en-us/dotnet/api/system.string.join?view=netframework-4.8
| IPAddress[] successfulConnections = TestSubnetConnectivity(args[0], 1433, resolvedAddresses); | ||
| MeasureAverageResponseTimeForSuccessfulConnections(successfulConnections, 1433); | ||
| PingTCP(args[1], 3342); | ||
| } catch (Exception e) |
No description provided.