Реализована запись полученных кадров в файл

This commit is contained in:
Пытков Роман
2025-09-19 23:10:54 +03:00
parent c27e78cffe
commit af62ec6375
6 changed files with 183 additions and 6 deletions

View File

@@ -9,9 +9,17 @@ using NetworkTest;
using Server;
using Server.DataGenerator;
if (args.Length == 0 || args.Contains("--help") || args.Contains("-h"))
{
PrintHelp();
return 0;
}
if (args.Length < 3)
{
System.Console.WriteLine("Pass three args: test/http/tcp, json/bin, and random/predictable");
Console.WriteLine("Error: Insufficient arguments provided.");
Console.WriteLine();
PrintHelp();
return -1;
}
@@ -115,6 +123,43 @@ while (!cts.Token.IsCancellationRequested)
return 0;
static void PrintHelp()
{
Console.WriteLine("NetworkTest Server - A network testing server application");
Console.WriteLine();
Console.WriteLine("USAGE:");
Console.WriteLine(" Server <protocol> <serialization> <generator> [delay]");
Console.WriteLine();
Console.WriteLine("ARGUMENTS:");
Console.WriteLine(" <protocol> The protocol to use:");
Console.WriteLine(" - test: Run serialization performance test mode");
Console.WriteLine(" - http: Start HTTP server");
Console.WriteLine(" - tcp: Start TCP server");
Console.WriteLine();
Console.WriteLine(" <serialization> The serialization format:");
Console.WriteLine(" - json: Use JSON serialization");
Console.WriteLine(" - bin: Use MessagePack binary serialization");
Console.WriteLine();
Console.WriteLine(" <generator> The data generator type:");
Console.WriteLine(" - random: Generate random data");
Console.WriteLine(" - predictable: Generate predictable data with optional delay");
Console.WriteLine();
Console.WriteLine(" [delay] Optional delay in milliseconds for predictable generator");
Console.WriteLine(" (only used when generator is 'predictable')");
Console.WriteLine();
Console.WriteLine("OPTIONS:");
Console.WriteLine(" --help, -h Show this help message");
Console.WriteLine();
Console.WriteLine("EXAMPLES:");
Console.WriteLine(" Server http json random");
Console.WriteLine(" Server tcp bin predictable 1000");
Console.WriteLine(" Server test json random");
Console.WriteLine(" Server --help");
Console.WriteLine();
Console.WriteLine("The server will start and listen for connections. Press Ctrl+C to stop.");
}
void PrepareResponseJson(Data data, HttpListenerResponse response)
{
JsonData jsonData = new JsonData(data);