Skip to content

SatapasT/Instant_Messenger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instant Messenger Application README for functionality and startup

Important Note:
 - Use CMD/Command Prompt to run the server, client, and set environment variables. Other terminals may not work properly.

Client Setup - Steps to Run the Client

1) Navigate to the directory containing the client.py file.
2) Run the following command in the terminal: python client.py [username] [server_name] [port] (e.g., python client.py Alice localhost 12345).
	- Replace [username] with the desired username
	- Replace [server_name] with the server's address which is localhost or 127.0.0.1
	- Replace [port] with the server's port number
3) The client will connect to the server. If the username is already taken, you'll be prompted to use a different one.




Server Setup - Steps to Run the Server

1) Navigate to the directory containing the server.py file.
2) Run the following command in the terminal: python server.py [port] (e.g., python server.py 12345).
	- Replace [port] with the desired port number
3) The server will start listening for client connections.
4) To close the server gracefully, press CTRL+C




Accessing the Server Shared Files Folder

The shared files folder must be set up on the server before any file-sharing commands can be used. Follow these steps to set up and access the shared folder.

1) Set the SERVER_SHARED_FILES Environment Variable by running the following command to set the shared folder: set SERVER_SHARED_FILES=[Directory] 
	- Replace [Directory] with the path to the folder you want to share
	- (e.g, set SERVER_SHARED_FILES=c:\SharedFiles)
2) Once the server is running, the client must run the following command to gain access to the shared files folder: /access_shared_files
3) After running /access_shared_files, the client weill receive a confirmation message indicating that access to the shared files folder was successful. The client can now use file-sharing commands such as /list_files, /files_number, and /download.




Features - Functionality and command for invoking them

Messaging:
- Broadcast Messaging: Any message sent by the client will be default be a broadcast which send the messages to all connected clients.
- Private Messaging: Use the /whisper [username] [message] command to send a private message.

File Sharing (Require Shared Files Folder Access):
 - Shared Files Folder Access: /access_shared_files will sets up access to the folder defined by the SERVER_SHARED_FILES environment variable.
	- The shared files folder is set server-wide using the environment variable and cannot be specified by the client.
	- Ensure the environment variable is set before starting the server.
	- If SERVER_SHARED_FILES is set to c:\SharedFiles, running /access_shared_files will provide access to that folder.
- Download File: /download [filename] downloads a file from the shared folder to a directory named after the client's username.
- File Count: /files_number displays the number of files in the shared folder.
- List All File: /list_files displays all the files in the shared folder along with their size in bytes.
- List Downloaded Files: /list_downloaded displays all the files that the client has downloaded during the session.

Other:
- Closing client: /close will close the current connection to the server.
- Closing the server: Press CTRL+C to close the server.




Command cheat sheet

|   Command               |   Description                                            |   Example                       |
|-------------------------|----------------------------------------------------------|---------------------------------|
| /whisper                | Sends a private message to a specific user.              | /whisper Bob Hello, Bob!        |
| /access_shared_files    | Sets up access to the server-wide shared files folder.   | /access_shared_files            |
| /list_files             | Lists all files in the shared folder.                    | /list_files                     |
| /download               | Downloads a specified file from the shared folder.       | /download image.jpg             |
| /files_number           | Displays the number of files in the shared folder.       | /files_number                   |
| /list_downloaded        | Lists all files downloaded by the client.                | /list_downloaded		       |
| /close                  | Disconnects from the server.                             | /close                          |

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages