Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Sending files between clients, procedure #7

Open
ValliereMagic opened this issue Aug 6, 2017 · 0 comments
Open

Sending files between clients, procedure #7

ValliereMagic opened this issue Aug 6, 2017 · 0 comments
Assignees
Projects

Comments

@ValliereMagic
Copy link
Member

ValliereMagic commented Aug 6, 2017

code snippet:

int count; byte[] buffer = new byte[8192]; while (((count = in.read(buffer)) > 0) { out.write(buffer, 0, count); }

Step 1: A client decides to send a file to another client, and specifies the file path, of the file to send.

Step 2:
Alert the server that a client would like to send a file to another client.
Data is encrypted, and sent to server: sending user's username hash, recipient user's username hash, and file size

Step 3:
Server receives this message, and checks if the sending user has a valid session, and makes sure the file isn't too big. The server will respond with a message saying if the client can send a file or not. If the server allows the file to be received, it will start listening for bytes from the user.

Step 4:
The client receives the yes or no, If denied, then the client will display an alert to the user. If successful, the client will begin encrypting the file, and then send it to the server.

Step 5:
The Server receives, and begins writing the file to a temporary file folder managed by the server.

Step 6:
If the receiving user is online, or when the receiving user comes back online, the server will send a request to the receiving client, asking if they would like to receive the file, specify it's size, specify it's original file name, and display who it is from. (only if the user has talked with them before. Otherwise, it will display a username hash)

Step 7:
The user either accepts or denies the request, and sends their response to the server. If they accept, the client will start listening for bytes to be received from the server.

Step 8: The server receives the answer to the request to send a file. If the request is denied, the file will be deleted from the server directory. If the request is accepted, the server will begin sending the file to the client. when the file is completely sent, the file will be deleted from the server.

Step 9: The file is received by the client, decrypted, and written to disk where the user specified.

Notes:
http://www.rgagnon.com/javadetails/java-0542.html

@ValliereMagic ValliereMagic added this to TODO in Proj Aug 6, 2017
@ValliereMagic ValliereMagic self-assigned this Sep 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Proj
TODO
Development

No branches or pull requests

1 participant