Code Monkey home page Code Monkey logo

cs3516-prog3's Introduction

CS 3516 Program 3

Program 3, Sending Photos to a Concurrent Photo Server, for WPI CS 3516 B01.

By Ben McMorran and Gordon Gao

This program simulates the application, network, datalink and physical layers.

Each layer lives in its own file: client/server.c, network.c, data_link.c, and physical.c respectively.

OVERVIEW

The network layer proceeds to send a request to the datalink and then physical layer to establish a TCP connection with the server. The physical layer is simulated using a TCP connection. An initial packet is sent to establish this connection containing the client id and number of photos.

The client parses through the photo jpg files to send 200 bytes of data to the network layer. The network layer encapsulates this payload in a packet, including packet type, length, and end of photo fields and then sends it to the datalink layer. The datalink encapsulates it with sequence number, end of packet, length, and error detection fields. It sends it to the physical layer which sends it to the server physical layer. It then proceeds back up the stack on ther server.

The server sends a ACK frame at the datalink layer and then a network ack at the network layer, which itself is encapsulated inside a data frame. It stores the payload of the image data packet into the correct file based on client id.

KEY POINTS

SELECT is used in this program to properly implement timeouts. See physical.c line 137. It waits after sending a frame and resends if an ACK is not received within an appropriate timeout interval.

Duplicate frames are handled by this program. See data_link.c line 193. Duplicate frames are ACKed, but dropped.

Sequence numbers are only increased after sucessfully receving a new ACK or data frame.

While this code has error handling functions, including timeouts and duplicate frame handling, there are still subtle issues with our handling of corrupted frames. Because of this, corruption is turned off by default in our application to ensure successful photo transfer. However, corruption functions are present and error detection works correctly, including XOR folding and verification.

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.