gasshow1325 / rtp Goto Github PK
View Code? Open in Web Editor NEWThis project forked from rovinbhandari/rtp
Implementation of a simple Remote Timestamp Protocol (RTP) client and multi-threaded server using UDP as the transport layer protocol.
This project forked from rovinbhandari/rtp
Implementation of a simple Remote Timestamp Protocol (RTP) client and multi-threaded server using UDP as the transport layer protocol.
Simple RTP Client+Server ======================== Description ----------- RTP stands for Remote Timestamp Protocol. The implementation of RTP consists of a client application and a server application; the client can ask for the (last modified) timestamp of a file on the remote machine while the server satisfies that request. RTP uses User Datagram Protocol (UDP) as its transport layer protocol. High-Level Implementational Details ----------------------------------- The server creates a socket in the internet domain bound to port SERVER_PORT. The server receives requests through this port, processes the requests and replies to the client which had made the request. The client also creates a socket in the internet domain, sends requests to SERVER_PORT of a given IP address (i.e., server's IP address), and receives replies and displays results obtained from the server. The state-machines for a single connection for client and server are as the following: Client side protocol state machine: | | begin | ____V_____ | | | closed |________ |________| \ startup, request /\ \ | \ | | | _____V_____ done/ | | | done_acknowledgement | request | | | sent | | |_________| | | | | | | ____|____ | | | / | wait, | / request_acknowledgement | done |/________/ |_______|\ Server side protocol state machine: | | begin | ____V_____ | | | closed |________ |________| \ request, request_acknowledgement /\ \ | \ | | | _____V_____ | | | done_acknowledgement | new | | | request | | |_________| | | | | | | ____|____ | | | / | done | / query file timestamp, done | sent |/________/ |_______|\ The server handles each client with a separate thread; the main thread of the server spawns a new thread at a new incoming request. Since UDP is connectionless, the incoming datagrams are matched to their threads using connection_id. The threads the server can spawn are bounded by an upper limit (i.e., the threads reside in a finite-sized thread pool). Threads are not made to wait on spin-waiting loops, conditional-wait with mutex has been used to make threads wait and to notify a waiting thread. A thread after serving a client goes back to the pool of available threads. If the pool of available threads becomes empty at some stage and a new incoming request is pending, that request is dropped (which is justified since the underlying transport protocol is UDP anyway). The information between the client and the server is exchanged by means of custom packets. A packet has the following fields: 1. connection_id : given by the server if the request is a valid one and there is at least one thread in the pool of available threads. 2. type : varies among REQU (request) RACK (request_acknowledgement) DONE (done) DACK (done_acknowledgement) 3. status : determines the success or failure of finding the timestamp of a file. 4. buffer : contains data (garbage value if the packet is a control packet only). Since the byte order of the client, server and the network can all vary, the packets are converted to native architecture supported byte order when received and to network byte order at the time of sending.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.