-
Notifications
You must be signed in to change notification settings - Fork 0
Improve network throughput #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Sobottasgithub
wants to merge
67
commits into
main
Choose a base branch
from
develop
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,046
−2,370
Open
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
56655d2
update: correct Methods to METHODS
Sobottasgithub 5102ff1
update: remove unnecessary log messages
Sobottasgithub ab7e853
update: add ttp2 as flake input
TureBentzin c1d67ac
flake.lock: Update
TureBentzin 4dd6a6b
update: add libttp2 to build inputs
TureBentzin 010c658
update: link tablo against ttp2
TureBentzin 999b968
update: remove find_library instruction
TureBentzin b2bc90e
Merge pull request #17 from Sobottasgithub/ttp2
Sobottasgithub cfe0a0a
update: introduce new packages for subfolders
TureBentzin 8e80ac0
update: introduce tablo default packages and tablo-full support
TureBentzin 489f77a
Merge pull request #18 from Sobottasgithub/redesign_packages
Sobottasgithub c710ecb
update: update README with new build method
Sobottasgithub d1bf93f
update: remove tabnet
Sobottasgithub 0e82457
update: remove old tablo code from TabloClient and TabloMaster
Sobottasgithub 728e78f
update: update ttp2
Sobottasgithub 7da90b3
update: implement ttp2 in client networking WIP
Sobottasgithub 8b23e22
update: fix naming issue
Sobottasgithub 5e610d4
update: diable TabloNode until it is fixed
Sobottasgithub 729c525
update: add simple logic to client cli
Sobottasgithub ab9642e
update: finish implementation of network manager in client
Sobottasgithub 73c66d5
update: implement accept client in master
Sobottasgithub dd3e1cb
update: fix client crash
Sobottasgithub 990663c
update: implement simple client response cycle
Sobottasgithub f3f7731
update: remove falsely created thread in client
Sobottasgithub 8f94447
update: fix client network_manager
Sobottasgithub 199536d
update: use autoID from TTP2
Sobottasgithub b14bbe2
update: refactor udpDiscovery
Sobottasgithub bbe51d1
update: prepare to test updDiscovery
Sobottasgithub 221de4e
update: remove unnecessary log messages
Sobottasgithub 798bb93
update: revert test udpdiscovery
Sobottasgithub f22b911
update: implement TTP2 in node
Sobottasgithub ea99f47
update: establish conn to node
Sobottasgithub 4eb962f
update: handle node disconnect
Sobottasgithub 5958f7c
update: implement distribution logic
Sobottasgithub 1a4c1ad
update: rename order >> request
Sobottasgithub 49c1f87
update: rename solution >> response
Sobottasgithub 45863c3
update: fix node sending back empty packages
Sobottasgithub 0c01437
update: add --file as commandline argument to cli
Sobottasgithub 346a9a3
update: send file to node
Sobottasgithub 784ee5d
update: improve cli
Sobottasgithub cdc6943
update: add filetype when sending file WIP
Sobottasgithub 76b48d9
update: ttp2
Sobottasgithub 391325d
update: add TUD to Tablo
Sobottasgithub c23f767
Merge remote-tracking branch 'refs/remotes/origin/develop' into develop
Sobottasgithub bd40e72
update: implement tud
Sobottasgithub 4e498f5
update: remove old Udp Discovery
Sobottasgithub 381d25c
update: fixup tud
Sobottasgithub 39c0bb7
update: add supporting libs to readme
Sobottasgithub 556fc44
update: use tud namespace
Sobottasgithub 387c476
update: ttp2
Sobottasgithub 50f44ae
update: use namespace ttp2
Sobottasgithub 8ea06fd
update: add sendFile to client cli
Sobottasgithub fb58777
update: add sendFile as option to use
Sobottasgithub 94a392b
update: implement set File
Sobottasgithub 912a720
update: add viewport to cli
Sobottasgithub 1f098b4
update: implement viewport
Sobottasgithub c7e96b4
update: flake ttp2
Sobottasgithub 1bcfbe0
update: add csv_manager
Sobottasgithub 2f1a64a
update: fix typo in cli
Sobottasgithub f958977
update: add rowCount and columnCount
Sobottasgithub 8bad31a
update: add getRowByIndex
Sobottasgithub 5d48039
update: add getColumnByIndex
Sobottasgithub 4bfacd7
update: fix get first column
Sobottasgithub 0dd6fd4
update: implement Viewport
Sobottasgithub 28f7f35
update: flake
Sobottasgithub 97e6667
update: ttp2
Sobottasgithub 57475d6
update: fixup
Sobottasgithub File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #ifndef ARGV_STRUCT_H | ||
| #define ARGV_STRUCT_H | ||
|
|
||
| #include<string> | ||
|
|
||
| struct Argv { | ||
| std::string tabloMaster; | ||
| std::string filePath; | ||
| }; | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,134 @@ | ||
| #include "cli.h" | ||
|
|
||
| #include <ostream> | ||
| #include <client_session_controller.h> | ||
| #include <string> | ||
| #include <iostream> | ||
| #include <regex> | ||
| #include <fstream> | ||
| #include <thread> | ||
| #include <variant> | ||
|
|
||
| #include "networking.h" | ||
| #include "network_manager.h" | ||
|
|
||
| Cli::Cli(std::string tabloMaster) { | ||
| Cli::Cli(struct Argv argv) { | ||
| std::string tabloMaster = argv.tabloMaster; | ||
| std::string filePath = argv.filePath; | ||
|
|
||
| std::wcout << "Client! Tablo master at: " << tabloMaster.c_str() << std::endl; | ||
| Networking networking; | ||
|
|
||
| NetworkManager networkManager; | ||
|
|
||
| if (networkManager.createSocket(tabloMaster) < 0) { | ||
| std::wcout << "Create network manager failed!" << std::endl; | ||
| return; | ||
| } | ||
|
|
||
| std::thread networkingThread( | ||
| &Networking::networkingCycle, | ||
| &networking, | ||
| tabloMaster | ||
| ); | ||
| sendFile(filePath, &networkManager); | ||
|
|
||
| while (true) { | ||
| int method; | ||
| std::wcout << "Method: "; | ||
| std::cin >> method; | ||
| std::wcout << std::endl; | ||
| std::wcout << "Choose option\n(1) send Packet\n(2) read Packets\n(3) send File\n(4) get Viewport\noption:"; | ||
| std::string option = ""; | ||
| std::cin >> option; | ||
| if (option == "1") { | ||
| std::string content; | ||
| std::wcout << "Content: "; | ||
| std::cin >> content; | ||
|
|
||
| std::string content; | ||
| std::wcout << "Content: "; | ||
| std::cin >> content; | ||
| std::wcout << std::endl; | ||
| ttp2::Networking::Packet packet; | ||
|
|
||
| networking.pushOrder(method, content); | ||
| ttp2::Networking::Standard payload; | ||
| payload.payload = content; | ||
| packet.payload = payload; | ||
|
|
||
| std::wcout << "Waiting for solution..." << std::endl; | ||
| while (!networking.hasSolution()) {} // Wait for solution | ||
| networkManager.pushRequest(packet); | ||
| } else if (option == "2") { | ||
| if (networkManager.hasResponse()) { | ||
| while (networkManager.hasResponse()) { | ||
| ttp2::ClientSessionController::Packet response = networkManager.popResponse(); | ||
|
|
||
| if (std::holds_alternative<ttp2::ClientSessionController::Standard>(response.payload)) { | ||
| ttp2::ClientSessionController::Standard responsePayload = std::get<ttp2::ClientSessionController::Standard>(response.payload); | ||
| std::wcout << "Response:\nID: " << response.id << "\nPayload: " << responsePayload.payload.c_str() << std::endl; | ||
| } else if (std::holds_alternative<ttp2::ClientSessionController::File>(response.payload)) { | ||
| ttp2::ClientSessionController::File responsePayload = std::get<ttp2::ClientSessionController::File>(response.payload); | ||
| std::wcout << "Response:\nID: " << response.id | ||
| << "\n----payload----\nFilePath: " << responsePayload.filePath.c_str() | ||
| << "\nStart: " << responsePayload.start | ||
| << "\nEnd: " << responsePayload.end | ||
| << "\nPayload: " << responsePayload.payload.c_str() | ||
| << "\n---------------" << std::endl; | ||
| } else if (std::holds_alternative<ttp2::ClientSessionController::Viewport>(response.payload)) { | ||
| ttp2::ClientSessionController::Viewport responseViewport = std::get<ttp2::ClientSessionController::Viewport>(response.payload); | ||
| if (responseViewport.payload.length() > 0) { | ||
| std::wcout << responseViewport.payload.c_str() << std::endl; | ||
| } else { | ||
| std::wcout << "Empty Viewport" << std::endl; | ||
| } | ||
|
Copilot marked this conversation as resolved.
|
||
| } | ||
| } | ||
| } else { | ||
| std::wcout << "There are currently no packets to read!" << std::endl; | ||
| } | ||
| } else if (option == "3") { | ||
| std::string filePath; | ||
| std::wcout << "CSV Filepath:"; | ||
| std::cin >> filePath; | ||
|
|
||
| sendFile(filePath, &networkManager); | ||
| } else if (option == "4") { | ||
| int xStart; | ||
| int xEnd; | ||
| int yStart; | ||
| int yEnd; | ||
|
|
||
| std::wcout << networking.popSolution().c_str() << std::endl; | ||
| std::wcout << "xStart:"; | ||
| std::cin >> xStart; | ||
| std::wcout << "xEnd:"; | ||
| std::cin >> xEnd; | ||
| std::wcout << "yStart:"; | ||
| std::cin >> yStart; | ||
| std::wcout << "yEnd:"; | ||
| std::cin >> yEnd; | ||
|
|
||
| ttp2::Networking::Packet packet; | ||
| ttp2::Networking::Viewport payload; | ||
| payload.xStart = xStart; | ||
| payload.xEnd = xEnd; | ||
| payload.yStart = yStart; | ||
| payload.yEnd = yEnd; | ||
| packet.payload = payload; | ||
|
|
||
| networkManager.pushRequest(packet); | ||
| std::wcout << "Send Viewport request!" << std::endl; | ||
| } else { | ||
| std::wcout << "invalid" << std::endl; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| void Cli::sendFile(std::string filePath, NetworkManager* networkManager) { | ||
| if (filePath.length() != 0) { | ||
| std::ifstream file(filePath); | ||
|
|
||
| if (file.is_open()) { | ||
| std::string fileContent; | ||
| std::string line; | ||
| int lineCount = 0; | ||
| while (std::getline(file, line)) { | ||
| lineCount++; | ||
| fileContent = fileContent + line.c_str() + "\n"; | ||
| } | ||
| file.close(); | ||
|
|
||
| ttp2::Networking::Packet packet; | ||
| ttp2::Networking::File payload; | ||
| payload.filePath = filePath; | ||
| payload.start = 0; | ||
| payload.end = lineCount; | ||
| payload.payload = fileContent; | ||
| packet.payload = payload; | ||
|
|
||
| networkManager->pushRequest(packet); | ||
| std::wcout << "Send file with FilePath: " << filePath.c_str() << std::endl; | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,17 @@ | ||
| #ifndef CLI_H | ||
| #define CLI_H | ||
|
|
||
| #include <string> | ||
| #include "network_manager.h" | ||
|
|
||
| #include "argv_struct.h" | ||
|
|
||
| class Cli | ||
| { | ||
| public: | ||
| Cli(std::string tabloMaster); | ||
| Cli(struct Argv argv); | ||
|
|
||
| private: | ||
| void sendFile(std::string filePath, NetworkManager* networkManager); | ||
| }; | ||
|
|
||
| #endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.