Giter VIP home page Giter VIP logo

data-transfer's Introduction

Data-Transfer

Simple Headerfile library for sending string message using winsock.

Quick note: this code need a lot of optimization

HOW TO USE IT

Warning!! the easiest way to work with the library is to use visual studio compiler, gcc still don't support timeout (still requires it as argument)

Installation and configuration

first download Send.hpp (for visual studio, or for gcc compiler) (used for sending messages) and Recive.hpp (for visual studio, or for gcc compiler) (used for reciving). Move them to the folder with your code, then #include them (#include "Recive.hpp" and #include "Send.hpp"). Use Send() and Recive() functions.

Send() function

file for visual studio : Send.hpp
file for gcc compiler : Send.hpp

Syntax : Send(string msg, string host, int port, int timeout)

Example of use : here

Arguments

Argument Description
message string to send
host host adrress as a string
port port adress as a int
timeout time in miliseconds after program will resend data

Recive() function

file for visual studio : Recive.hpp
file for gcc compiler : Recive.hpp

Syntax : Recive(string host, int port)

Example of use : here

Arguments

Argument Description
host host adress as a string
port port adress as a int

HOW IT WORKS

SENDER

  1. We get the string x to send to the client.
  2. We split x into packets with id
  3. We send every packet
  4. We receive ids from the reciver
  5. if any ID is missing we resend packet with that id untill we receive this id back

RECIVER

  1. We receive packet with ID
  2. Ans[ID] = packet
  3. We resend ID
  4. receive new messages while all packets aren't received

image

Hope this code will be useful.

data-transfer's People

Contributors

stanleeeeey avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.