Code Monkey home page Code Monkey logo

chatbox's Introduction

ChatBox

This is a code I made for my Networks project with another friend.

How to Use:

1)Copy the code onto two different machines or two different folders on the same machine 2)Start two different sessions, compile the code ( gcc Transfer.c -o client), and run it (./client)

  1. The program asks you to enter the port on which it will listen, enter a value (eg: 5000)
  2. Choose the mode (O for TCP and 1 for UDP)
  3. Enter the server address to which you want to connect ( Eg: 6000)

Note: Now the program tries to connect with the server listening on this port and will wait till it establishes a connection

  1. Once connection is established, the program will work.

Commands - A) Commands to check integrity of data: 1) FileHash CheckAll - Hashes all the files on the server (the OTHER folder/machine) and returns there md5 values 2) FileHash Verify - Hashes the corresponding file in server and prints its md5 when compared to the local copy B) Commands to get index/list of files on server 1) IndexGet ShortList - Gives info about requested file 2) IndexGet LongList - Gives List of all the files on the server 3) IndexGet Regex - Gives info of all the files on the server matching the regex (EG: "IndexGet Regex *.c" lists all C files present on the server)

C) Commands to transfer file data
	1) Upload <filename> - Command uploads a local file to the server. It asks permission from the other user before uploading.
		Eg: User1 : Upload a.txt
		    User2 sees " 
		    		 Someone wants to Upload File a.txt
		    		 Type "Allow" to let them, "Stop" to prevent them.
				"
		    If User2 types "Allow" Transfer happens, else its stopped
	2) Download <filename> - File is downloaded
D) Others
	1) q or Q - if written on a single line, all by itself, asks the local program to shut down. The server continues to run
	2) Any other data is interpreted as text and send as a chat msg. The server prints it out as such

Known Issues- 1) File Transfers (Upload or Download) though working in most cases, hang up while transferring certain kinds of files.[Certain pdfs/mp3 files] 2) Wrong Usage of commands may lead to a hangup 3) q closes the local copy and the client of the server. But the server needs to be closed manually

Use this code as you wish. Suggest changes/ edits to make this better.

Cheers

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.