联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2025-04-16 09:14

Implement Message Application using sockets in Python which includes the following features:


●Support multiple users

●Support users’ login and logout (with user ID and unencrypted password)

●After log in, users are able to manage their friend’s list (add or delete) using their friend’s ID

●Users can send message with any of their friends

●Support messages with single or multiple lines.

●Messages are sent to the specified friends only

●Users can send a message to multiple friends

●Users can broadcast a message to all of their friends

●Users can send text files to other users

●Users can’t send further messages after logging out.

●Users can read and manage their messages or files (add or delete)

●After the messages or files are read, the system will send an acknowledgement message back to the sender.

●All users' information, friends’ lists and messages are stored in the message server.

●Message server assumes a default list of 10 users when startup.  


Sample Interfaces:


1.Client connected to the chat server will be prompted to login:


Welcome to Message System

----------------------

Please login

Your user ID: jimmy

Your password: ******


2.After login, user will be shown the main menu:


Welcome to Message System

----------------------

Please choose one of the following option:

1. Manage your friend list

2. Send message to your friend(s)

3. Broadcast message to all friends

3. Send file to your friend(s)

4. View your messages and files

5. Logout

Your Option: 1


3.Choose the 1st item (Manage your friend list) will show the following submenu:


Manage your friend list

-----------------------

Please choose one of the following option:

1. View your friends

2. Add a new friend

3. Delete your friend

4. Return to main menu

Your Option: 1


4.Picking the 1st item (View your friends and their statuses) will show the following:


View your friends and their statuses

------------------------------------

jimmy

mary

peter

david

john

Press Enter to return to the previous menu.


5.Picking 2nd item (Add a new friend) will show the following:


Add a new friend

----------------

Please enter your new friend's ID: george

Your friend george has been added to your friend's list

Press Enter to return to the previous menu.


Note:  the ID must already exist in the server.


6.Add an inexistent ID will show the following:


Add a new friend

----------------

Please enter your new friend's ID: jason

jason doesn't exist in the system.

Press Enter to return to the previous menu.


7.Picking 3rd item (Delete your friend) will show the following:


Delete your friend

------------------

Please enter your friend's ID: david

Your friend david has been deleted from your friend's list

Press Enter to return to the previous menu.


Note:  The ID must be one of your friends, or the system will show the error.


8.Picking the 2nd item in main menu (Send message to your friend(s)) will show the following:


Send message to your friend(s)

-----------------------------

Please enter your friend's ID (x to end): mary

Please enter your friend's ID (x to end): peter

Please enter your friend's ID (x to end): x


Type your message (2 newlines to end):


Note:  The ID must be your friends, or the system will show the error.


Once done, it will return back to the main menu


9.Picking the 3rd item in the main menu (Broadcast to all of your friends) will show the following:


Broadcast message to your friends

-----------------------------

Type your message (2 newlines to end):


Once done, it will return back to the main menu



10.Picking the 4th item in main menu (Send file to your friend(s)) will show the following:


Send file to your friend(s)

---------------------

Please enter your friend's ID (x to end): mary

Please enter your friend's ID (x to end): peter

Please enter your friend's ID (x to end): x


Enter the file name:


Note:  The ID must be your friends, or the system will show the error.

Note:  The file must be a text file, and it must exist in the same directory of the program.  Or the system will show the error.


11.Picking the 4th item (View your messages and files) will show the following:


View your messages and files

----------------------------

Please choose one of the files or messages:

1. file1.txt [jimmy]

2. Message1 [jimmy]

3. file2.txt [mary]

Your Option: 1


If selecting the wrong option will display the error.


12.Viewing the message or file will send an acknowledgement back to the sender.  In the sender’s mailbox, he/she will receive the acknowledgement message.


View your messages and files

----------------------------

Please choose one of the files or messages:

1. file1.txt acknowledgement [peter]

Your Option: 1


Acknowledgement content:

File (or message) has been read.


13.Picking any of the messages or files will display the content:


Hello How are you?


Please choose one of the followings:

1. Delete the message or file

2. Return to main menu

Your option: 1



14.Picking Delete the message will delete the message or file and return to main menu


相关文章

【上一篇】:到头了
【下一篇】:没有了

版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp