GithubHelp home page GithubHelp logo

socket-programming's Introduction

Socket-Programming

Application 1 - File Compression

The client in this application sends files to the server which are compressed using Lempel-Ziv compression technique and sent back to the client.

The client sends the file to be compressed to the server in multiple packets using the connection oriented Transmission Control Protocol. It then waits for an acknowledgement from the server before sending the next packet. After the server compresses the file, the client again establishes a connection with the server to recieve the compressed file. This time the client receives packets from the server and sends acknowledgements.

The established sockets were working seamlessly and we were getting fully lossless data compression. We were getting about 14% compression after performing Lempel-Ziv compression. This is an iterative server since queries are handled sequentially as opposed to parallel.

Application 2 - Data Link Layer

Implemented Go-back-n protocol In the go-back-n protocol, then sender continues to send frames till a window size (which is predetermined) even without ACK packet from the receiver. The receiver knows the sequence number of whichever frame it is expecting to receive. If the sequence number of the frame is not equal to the sequence number that the receiver expects, the receiver discards it and resends the ACK for the last “correct” frame it receives. After the sender has sent every frame (in the window), it will go back to the sequence number of last ACK it received from the receiver and will empty and then refill the window from that frame and continues it.

Both server and client can send packets to the other end of the connection. Let us suppose, for explanation sake, that client wants to send the packets to the server. We have used python random number generator [0,1] to generate a value for each packet, and if that probability comes out to be greater than p = 0.9 then we drop that packet otherwise the packet is sent on the network. If the packet was dropped, according to the above procedure, then the client wouldn’t receive an ack for that same.

Thus, the go-back-n protocol would come into effect and client would go back to the last packet sent correctly(for which it received an ack, in order) and would send the whole n-window to the receiver again starting from the first packet for which it didn’t receive the ack correctly. On the other hand, the receiver, when receives a packet, it puts a timestamp on it and sends the ack back to the sender and then again waits for the next packet. If a packet received by the receiver is wrong (aka out of order) then: It resets it count and wait for the correct (missed) packet again, followed by all other packets (in-order).

Made by:

Madhav Sainanee

Rishabh Sharma

Dhruv Kundu

Jay Rawal

socket-programming's People

Contributors

sainanee avatar

Watchers

James Cloos 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.