Enhancements

This commit is contained in:
2025-08-14 17:32:16 -04:00
parent 8b4769bf7e
commit f441b186b5
3 changed files with 58 additions and 36 deletions

View File

@@ -26,38 +26,55 @@ void handleClient(Block<String> &commands);
/// @return
int main(int argc, char **argv)
{
int returnCode(0);
Profiler profiler;
String version = "1.00";
if(argc<2)
std::cout << "sstp version " << version.str() << std::endl;
try
{
std::cout << "sstp SERVERMODE {port} | CLIENTMODE {serveripaddress} {serverport} {pathfileName}." << std::endl;
std::cout << "SERVERMODE will listen on the specified port for a connection and receive the specified file." << std::endl;
std::cout << "CLIENTMODE willl connect to the specified address and port and send the specfied file." << std::endl;
return 1;
}
Block<String> arguments;
for(int index=0;index<argc;index++)
{
String item(argv[index]);
arguments.insert(item);
}
if(argc<2)
{
std::cout << "sstp SERVERMODE {port} | CLIENTMODE {serveripaddress} {serverport} {pathfileName}." << std::endl;
std::cout << "SERVERMODE will listen on the specified port for a connection and receive the specified file." << std::endl;
std::cout << "CLIENTMODE willl connect to the specified address and port and send the specfied file." << std::endl;
return 1;
}
Block<String> arguments;
for(int index=0;index<argc;index++)
{
String item(argv[index]);
arguments.insert(item);
}
std::cout << argv[1] << std::endl;
if(arguments[1]=="SERVERMODE")
{
handleServer(arguments);
std::cout << argv[1] << std::endl;
if(arguments[1]=="SERVERMODE")
{
handleServer(arguments);
}
else if(arguments[1]=="CLIENTMODE")
{
handleClient(arguments);
}
else
{
std::cout << "Unknown command " << arguments[1] << std::endl;
returnCode=-1;
}
}
else if(arguments[1]=="CLIENTMODE")
catch(Exception& exception)
{
handleClient(arguments);
}
else
{
std::cout << "Unknown command " << arguments[1] << std::endl;
std::cout << exception.toString() << std::endl;
returnCode=-1;
}
catch(...)
{
std::cout << "An unhandled exception was encountered" << std::endl;
returnCode=-1;
}
return 0;
std::cout << "Done, total took " << Utility::formatNumber(profiler.end()) << "(ms)" << std::endl;
return returnCode;
}
/// @brief [0]=program [1]=SERVERMODE [2]={port}