Giter Site home page Giter Site logo

directshare's Introduction

directShare

Tiny P2P File Sharing in C#

How it Works

DirectShare works as a client server linking through a network stream to send data. The server UI exists as a command line where files can be sent to different clients which connect to it. When a file is sent to the client by the server it first writes the amount of bytes as a string to the stream. The client recieves this number and throws an event asking the user if they want to accept the file, if so it reads that amount of bytes from the stream and saves them to disk. The pros of this system are that everything from sending to recieving to saving operates on a stream, meaning that if you are sending large files at no time will the entire file be hogging up RAM.

The Protocol

DirectShare protocol is very simple. When the server sends the length of the file to the client it writes this to the stream:

[BYTE_SIZE] + "\r\n"

From there it writes each byte of the file to the stream.

Sample Run:

Server:

$ ./DirectShare.exe -s 127.0.0.1 1337
> Client connected from 127.0.0.1. Check client list with list command

> send 0 /home/reagan/Hassium/src/Hassium/bin/Debug/Hassium.exe
>

Client:

$ ./DirectShare.exe -c 127.0.0.1 1337
Data of size 305664 recieved! Accept? y/n 
y
Enter path to save location: 
/home/reagan/has.exe

directshare's People

Contributors

jacobmisirian avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.