Thanks to TCExecutor you can add communication/configuration layer to your application in just four steps:
- Create TCExecutor object
- Define commands
- Hook up your code to commands events (TCExecutor is multithread/multiconection application remeber that your code must be threadsafe)
- Start TCExecutor listener.
Commands style:
>command1 subcommand1 ... subcommandN param1=X1 ... paramN=XN ARGV1...ARGVN
Features:
Project in action>command1 subcommand1 ... subcommandN param1=X1 ... paramN=XN ARGV1...ARGVN
Features:
- Adds network communication layer to your application
- Supports multiple connections. For each connection separate session is established.
- Commands can be defined at your application startup.
- Each command has separate event to which you can connect to.
- Each command has a short and long help string which helps end user to navigate through available options.
- Enable SSH connections to the TCExecutor.
- Add simple user autentication. Login password.
Project can be found here: https://bitbucket.org/chesti/tcexecutor/
You can clone code from git: git clone https://bitbucket.org/chesti/tcexecutor.git
using TelentCommandExecutor; class ProgramObject { private TCExecutor executorSRV; public ProgramObject() { //create an executor executorSRV = new TCExecutor(); //hook up some commands CmdExecutor e; e = executorSRV.AddCommand("set name"); e.ExecutorEvent += new CmdExecutor.ExecutorHandler(Execute_SetName); e.HelpString = "set name n=name"; e.ShortHelpString = "Dispalys your name"; //listen to the any end point on port 9999 System.Net.IPEndPoint endPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Any, 9999); //start executor executorSRV.StartServer(endPoint); Console.ReadKey(); //stop executor and disconnect all users. executorSRV.StopServer(); } //handle command event string Execute_SetName(Cmd command) { if (command.CmdParams.ContainsKey("n")) { return String.Format("Your name is: {0}", command.CmdParams["n"]); } else { return "Use n= parameter"; } } }
How many threads is created per tcp/ip connection? Suppose I have 1000 simultaneous connections. Is that mean that 1000 threads will be created?
ReplyDeleteHi Hats.
DeleteThanks for your comment.
Answer to your question is yes it will create 1000 threads.
I wasn't designing this library to support so many connections; I was thinking of a few.
In this case I've decided to limit the maximum number of connections and I'll think of slightly different arhitecture to support many incoming connections in future releases.
What do you think about max 100 threads each supporting max 100 connections? (it will give 10 000 simultaneous connections on 100 threads)
It would be nice to have a number of worker threads configurable somehow.
ReplyDeleteThanks.
Hi Hats,
DeleteI've created an issue report for that:
https://bitbucket.org/chesti/tcexecutor/issue/8/maximum-connections
Thanks