Пример #1
0
        public static void Main(string[] args)
        {
            // Before the app starts, let's build strings for you to use the console.
            BuildStringsForClientConsole();

            // Get settings and connection info.
            ConfigFileHandler configHandler = new ConfigFileHandler();

            // Start the log writer.
            testWriter = new TestFileWriter(configHandler.saveDirectory);

            // Create one object with a lot of settings, to pass to SocketClient.
            SocketClientSettings socketClientSettings = new SocketClientSettings(configHandler.remoteEndPoint, configHandler.totalNumberOfClientConnectionsToRun, configHandler.numberOfReceivedMessagesPerConnection, Program.maxSimultaneousConnectOps, configHandler.maximumNumberOfSimultaneousClientConnections, Program.receivePrefixLength, configHandler.testBufferSize, Program.sendPrefixLength, Program.opsToPreAlloc);

            // Build the arrays of messages that will be sent, and pass them
            // to the SocketClient object in a stack of arrays.
            MessageArrayController        messageArrayController  = new MessageArrayController(configHandler);
            Stack <OutgoingMessageHolder> stackOfOutgoingMessages = messageArrayController.CreateMessageStack();

            // Create the object that will do most of the work.
            SocketClient socketClient = new SocketClient(socketClientSettings);

            socketClient.GetMessages(stackOfOutgoingMessages);

            // Interact with the console.
            HandleConsoleInteraction(configHandler, socketClient);
        }
Пример #2
0
        public static void Main(string[] args)
        {
            // Before the app starts, let's build strings for you to use the console.
            BuildStringsForClientConsole();

            // Get settings and connection info.
            ConfigFileHandler configHandler = new ConfigFileHandler();
            
            // Start the log writer.
            testWriter = new TestFileWriter(configHandler.saveDirectory);
            
            // Create one object with a lot of settings, to pass to SocketClient.
            SocketClientSettings socketClientSettings = new SocketClientSettings(configHandler.remoteEndPoint, configHandler.totalNumberOfClientConnectionsToRun, configHandler.numberOfReceivedMessagesPerConnection, Program.maxSimultaneousConnectOps, configHandler.maximumNumberOfSimultaneousClientConnections, Program.receivePrefixLength, configHandler.testBufferSize, Program.sendPrefixLength, Program.opsToPreAlloc);

            // Build the arrays of messages that will be sent, and pass them
            // to the SocketClient object in a stack of arrays.            
            MessageArrayController messageArrayController = new MessageArrayController(configHandler);
            Stack<OutgoingMessageHolder> stackOfOutgoingMessages = messageArrayController.CreateMessageStack();

            // Create the object that will do most of the work.
            SocketClient socketClient = new SocketClient(socketClientSettings);
            socketClient.GetMessages(stackOfOutgoingMessages);
            
            // Interact with the console.
            HandleConsoleInteraction(configHandler, socketClient);
        }