{"id":17326404,"url":"https://github.com/kaldoran/send-file-p2p","last_synced_at":"2025-03-27T04:43:47.102Z","repository":{"id":73917429,"uuid":"46527954","full_name":"kaldoran/Send-file-P2P","owner":"kaldoran","description":"Network project, team a","archived":false,"fork":false,"pushed_at":"2018-11-21T13:05:24.000Z","size":292,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T10:13:11.204Z","etag":null,"topics":["network","p2p"],"latest_commit_sha":null,"homepage":"https://ead-sciences.univ-st-etienne.fr/courses/RESEAUM1WI/document/data/projet/projet.pdf","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaldoran.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-20T00:02:42.000Z","updated_at":"2018-11-21T13:04:12.000Z","dependencies_parsed_at":"2023-09-21T13:47:41.559Z","dependency_job_id":null,"html_url":"https://github.com/kaldoran/Send-file-P2P","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaldoran%2FSend-file-P2P","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaldoran%2FSend-file-P2P/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaldoran%2FSend-file-P2P/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaldoran%2FSend-file-P2P/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaldoran","download_url":"https://codeload.github.com/kaldoran/Send-file-P2P/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245785720,"owners_count":20671631,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["network","p2p"],"created_at":"2024-10-15T14:15:55.417Z","updated_at":"2025-03-27T04:43:47.083Z","avatar_url":"https://github.com/kaldoran.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NetWork (Fr : Réseau ) Project - P2P Team a.\n\n#### Before anything.\n  Before starting anything, you could compile our source code.\n  If you are on windows please be sure to Read the \"Windows compatibility\" File.\n  Else you could use our makefile, or use CMake.\n  \n  Please be sure to compile the part which you want to start before tryingto starting it.\n  \n  If you are a bit lazy, and you are on linux,\n  you could use the ./Scripts_Automatisation/make_all.sh\" script.\n  \n  You juste need to write : \"./make_all.sh\".\n  \n  Ps : you could use every compilation option by adding it at end of \"./make_all.sh\".\n  Ex : ./make_all.sh rebuild\n  \tThat's going to rebuild each program.\n\n### Compile option \n\nHere is the list of all compile option which you can use with our makefile.\n - make ( Create an executable program )\n - make all ( same as make )\n - make clean ( Clean the project )\n - make rebuild (Same as make clean followed by make )\n - make dir ( Create OBJ and BIn dir , this on is included in make / make all / make rebuild )\n \n\n### How to use it / test it ?\n\n#### Generator \n  First ( after compile that ) a new \"Bin\" directory appear.\n  You could now start the Generator by writing \"./Bin/Generator\". \n  \n  Then you just need to answer to Question. \n  \n  Exemple of use : \n  ```\n  \u003e ./Bin/Generator\n  [INFO] Welcome to this awesome Generator\n\n  [Q] On which file do you want to create the '.ndex' file ?\n  moveFile.bat\n  \n  [Q] What is the IP adress of the boss ?\n  127.0.0.1\n\n  [Q] What is the port to connect to ?\n  (From 1024 to 65536)\n  42000\n  \n  [Q] What size do you want the volumes to be ?\n  (Size in ko from 8 to 64, both included)\n  16\n  \n  [INFO] Boss : 127.0.0.1\n  [INFO] Port : 42100\n  [INFO] File : moveFile.bat\n  [INFO] Size : 62\n  [INFO] PackSize : 16000\n  [INFO] NbVolume : 1\n  [INFO] Volume 0\n\t  Sha1 : b4bcdca75363cb7e604db97dc9585f93f3bfe7a9\n\n  [INFO] : File 'moveFile.bat.ndex' had been generate\n  ```\n  \n  Now you can give the output file to our Collector. We will see how in Collector part.\n  \n#### Boss  \n  First ( after compile that ) a new \"Bin\" directory appear.\n  You could now start the Generator by writing \"./Bin/Server\". \n  \n  Exemple of use :\n  \n  ```\n  \u003e ./BIN/Server \n  [IMPORTANT] : Press Enter to Stop the Boss\n  ```\n  \n##### Understand what append :\n\nIf you don't understand a message, please refere here for the boss.\n\n**/!\\ Here we are not going to cover the debug mode.**\n\n----------------\n\n###### New Client \n\n\n```\n[INFO] New client [6]\n - Ip : 127.0.0.1\n - File : moveFile.bat\n - Port : 42450\n```\nHere a new client came on the Boss.\nWe can see is Ip, for which file he came, and on which port Others Collector need to connect to.\n\nAs you may see the number of the client does not start at \"1\", 6 is the socket number.\nPlease refere to that for all message.\n\nIf the client does not respond in time we've got this message : \n```\n[INFO] New client [21]\n\t - Ip : 127.0.0.1\n[ERROR] Client 21 does not send information in time\n```\nBy default, the client need to send information in less that 500 ms.\n\n----------------\n\n###### List Of Collector\n\n```\n[INFO] (18) message recu 'ListOfCollectors' [Client : 6]\n```\nHere the Client 6 ask for \"ListOfCollectors\" according to convention we need to send him back a message.\n```\n[INFO] Client 6 is alone\n```\nHere as he is alone we send him \"aloneCollector\". We can know that thanks to the previous message.\n\n----------------\n\n###### PING / PONG\n\nEvery 5 minutes, we send a \"ping\" message ( which is not ping but we identify it by \"ping\" )\n```\n[PING] Let send the ping test !\n```\nAfter 1 minute we check if Collectors respond.\n```\n[PONG] Let check the pong result \n```\nIf all client respond in time, nothing should be print under the [PONG] message. (  We do not print something to avoid flood )\n```\n[INFO] Client 6 do not respond to ping in time.\n[INFO] Client 6 disconnect\n```\nHere our dear Client 6 does not respond in time, we kick him.\n\n----------------\n\n###### Server Stop\nWhen you hit \"Enter\" the Boss will stop, you should get this message : \n```\n[BYE] Server stop\n```\n\nBut if there is still some collector, we kick them, and add a message for each kicked Collectors.\nThese message look like that : \n```\n[KICK] Stop socket of client 22\n```\nHere we kick the client with the 22th socket.\n\n----------------\n\n#### Collector\n  First ( after compile that ) a new \"Bin\" directory appear.\n  You could now start the Generator by writing \"./Bin/Collector\". \n  \n  Then you just need to answer to Question. \n  \n  Exemple of use : \nIn the following section we will use the example of the file \"Makefile\" correponding to the index \"Makefile.ndex\".\n\n```\nWhich .ndex do you want to use ?\n../Generator/Makefile.ndex\n\n[Q] On which port do you want to start the collector ?\n47777\n\n[Q] What is your sharing repository ? [Be carefull, if it doesn't exists we'll create it !]\nShare\n\n[IMPORTANT] : Press Enter to Stop the Collector\n```\n##### A bit of configuration :\nWe are aware that's this is boring to always fill the \"Sharing path\" so you could configure it by using\n\"./Collector/INC/configuration.h\"\n\nYou just need to read the content of this file.\nDon't forget to \"make rebuild\" at the end.\n\n##### Understand what append :\n\n---------------------------------------------------------\n\n###### Start an index\n```\n[INFO] Check if we've got the file to download.\n[ERROR] 'Makefile' does not exist.\n\t Then we create it\n\n[INFO] Ask for other collectors.\n[INFO] We are alone for the moment.\n```\nHere we haven't the file in the sharing repository. So the program creates a file temporary filled by '#' characters in the waiting of the real volumes.\n\nIf we have the file complete, the program says:\n```\n[INFO] Check if we've got the file to download.\n\t - we've got all volume\n```\n\nIf the file exists, but is not complete, the program says:\n```\n[INFO] Check if we've got the file to download.\n\t - Some volumes are missing\n\n[INFO] Ask for other collectors.\n```\n\n--------------------------------------------------------------------------------\n\n###### List of Volumes and List of Collectors\n\nThe program notify its request for a list of Collector by:\n```\n[INFO] Ask for other collectors.\n```\n\nIf there is no Collector which has the file:\n```\n[INFO] We are alone for the moment.\n```\n\nElse :\n```\n\t - Collector : 1 [127.0.0.1:47788]\n\t[INFO] Ask the list of volume [Socket : 21].\n\t\t - 21 got them all.\n\t - Collector : 0 [127.0.0.1:47789]\n[ERROR] Can't connect to collector.\n```\nHere, two Collectors have the file, one has the complete file, the other is not reachable (maybe disconnected).\n\n\nWhen the collector recieve a connection request of a new collector, it notify it by:\n```\n[INFO] New client [27]\n\t - Ip of client : 127.0.0.1\n```\n\nWhen the program recieve a request for its list of volumes it notify by\n```\n[INFO] (14) message recu 'ListOfVolumes' [Client : 24].\n```\n\nIf a connected client doesn't ask anything then the program disconnect it, and notify the closing of the connection by:\n```\n[INFO] Client 28 disconnect.\n```\n\n\n----------------------------------------------------------------------------------------------------------------\n\n###### Asking volumes\n\nAfter the program has filled the collectors list it start to ask volumes.\n```\n[INFO] Ask volume 0 to Client 21\n```\n\nif it respond with succes we've got \n```\n[INFO] Volume 0 well received \n```\n\nIf the collector is not reachable, the program says:\n```\n[ERROR] Client 21 does not send information in time\n```\n\nThen if there is too much collectors unreachable, the program asks a new colectors list to the boss:\n```\n[ERROR] To much people are useless.We're going to change the list.\n```\n\nWhen the program recieve a volume request it notify it by:\n```\n[INFO] (9) message recu 'Vol0' [Client : 22].\n\t - Send volume 0 to 22\n```\n\n----------------------------------------------------------------------------------------------------------------\n\n###### PING/PONG\n\nEvery 5 minutes the boss asks if the collector is still connected and has the file.\nThe program notify the reception of the ping request by:\n```\n[INFO] Received ping from Boss.\n```\n\n\n-------------------------------------------------------------------------------------------------------------\n\n###### Stop the Collector\n\nWhen you press \"Enter\" the collector stop, and notify it by:\n```\n[BYE] Collector stop.\n```\n\n\n\n----------------------------------------------------------------------------------------------------------------------\n\n### How to stop programms ? \n\nTo stop the programme, just hit \"Enter\" on the Boss, same on the Collector.\n\n#### How to use Script\n\nThere is only one script, which them is usefull to test spam on the boss.\nWith that you could see that the boss could handle a spam of connexion.\n\nTo use it go into the \"Scripts_Automatisation\" directory and use the \n\"./flood_boss.sh\" script.\n\nTo use it just tel how many collector you want to start \"./flood_boss.sh 15\".\nThis command will start 15 collectors.\n\nEach collector connect to the boss, ask list of collector and kill themself.\n\n\n### How to change into debug mode ?\n\n/!\\ All part are in normal use mode by default.\n\nTo start the debug mode, you just need to change ( each ) makefile, switch the \n\"DEBUG=no\" line 2 by \"DEBUG=yes\", then recompile it and then you can see Debug message.\n\nWhen debug mode is on, you could use each program with argument of the program.\nThat's avoid to get all questions !\n\n/!\\ If You want to try / use script that test automatically things you need to use debug mode !\n\nIf you want the debug mode on windows, please refere to \"Windows Compatibility\" file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaldoran%2Fsend-file-p2p","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaldoran%2Fsend-file-p2p","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaldoran%2Fsend-file-p2p/lists"}