Git Product home page Git Product logo

udp-socket-programming's Introduction

This code tries to implement a reliable sliding window protocol for data transfer between client and server in C language using Unix Socket APIs.

The sockets used are of UDP type.

The task performed is of reading data from a file at the client side and then transmitting that data to the server side and writing it into another file.




Steps to be followed to run client.c and server.c on two seperate Terminals

Step 1 - Initially compile the file server.c by using command
		
	 gcc -o server server.c
	 
Step 2 - Then run the executible created by using the command
	
	 ./server
	 
	Now the server side will be running in one terminal
	
Step 3 - Now we need to compile the file client.c in another terminal by using command

	 gcc -o client -pthread client.c -lm
	 
Step 4 - Then run the executible created using the command

	 ./client
	 
	Now the client side will be running in one terminal
	
Step 5 - The client program will prompt to enter the window size that has to be used while sending packets to the server side and after that it will 

	 prompt to enter the filname present in the current folder that has to be read and sent to server side.

	 enter the filename in terminal - "file.txt"
	
	 Here any file name can be entered provided that the file is present in the current folder and is of the type ".txt"
	
	
Step 6 - As you hit enter the client program will read data from the mentioned text file and start transmitting data to the 
	server side chunk by chunk
	
	In client side terminal the packet number of sent packets and window Base will be displayed along with the packet numbers for which 
	acknowledgement has been received from server side		
	
	In the server side terminal the received packet's number and packet number for which acknowledgement was sent will be displayed along with the 
	packet number of the packets that were dropped
	
	After all the chunks are sent and acknowledgements are received on the client side the client program will end.
	
	When the server side has received all the data packets and sent acknowledgements for all of them it will write the data from 
	these packets to a file named "out.txt" one by one and then server program ends.
	
	The file "out.txt" will contain text identical to what was present in "file.txt"
	
	
NOTE - 1)Currently the program has been executed upto window size 30
	
       2)Chunk size can also be altered by changing the value of the constant named "chunksize" in both server.c and client.c
       	Currently the program has been executed on chunk sizes - 16,32 and 64
	

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.