-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdesign.txt
109 lines (105 loc) · 4.54 KB
/
design.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
ChatRoom
————————————
David Lance
Alex Tryjankowski
————————————
ChatRoom is a client server based application that allows multiple clients to be created and lets them communicate with each other through the server.
————————————
Setup:
make - makes files client.o and server.o for linux machine
make mac - makes files for OS X machine
./server.o 51717 - makes server with given address (51718, etc. to be used if issues arise)
./client.o localhost 51717 - makes client to server with given address (must match server address) (can use ip address to connect to server on different machine) (can make multiple clients using same command)
————————————
Server:
No input is necessary for the server, it simply serves as a place to monitor input from all clients. You will see Usernames and Messages being output in this terminal window.
Ctrl+C closes instance of Server.
WARNING: Closing a Server instance before its Clients are closed may prevent you from running on same address. Either increment address by one or restart terminal
————————————
Client:
USERNAME
In order to start communicating, a username needs to be supplied. If must be no more than 20 characters and must be original (server checks for this). Once a valid username is supplied, a message will be displayed saying so.
MESSAGES
To send messages to other clients, simply type the desired message in the terminal window. This will then be send to the server and distributed to other clients.
COMMANDS
Commands are messages that are not sent to other users and simply interact with the server. (See command list section below)
————————————
Command List: (UNIMPLEMENTED commands function as normal messages)
/help - displays all commands
/exit - exits from client instance
/msg [clientName] [message] - sends message only to specified user
/online- list all registered clients
-- WORK ON MAC ONLY -- (WAS NOT ABLE TO BE COMPLETED BY SUBMISSION TIME)
/grpadd [group name] - creates a group (WORKS)
/grp [group name] [message] - sends a message to the group (WORKS)
/grpmem [group name] [clientName] - adds a client to the group (DOES NOT WORK)
————————————
Each client server interaction runs on its own thread
All client credentials are stored in an array of structs which is shared amongst the client threads
The client accout runs on two different threads one for reading and one for writing to the server
The group system stores all the group information in a array of structs (Group structs) which contains
the groups name, members (up to 5), and the number of members for sake of programming
————————————
CLIENT DEMO:
ATryjan:client-server-chatroom aetryjan$ ./client.o 172.20.3.137 51717
> Please enter a username: Bob
INVALID USERNAME: username already exists
> ThisNameIsTooLongxxxxxxxxxxxxxxxxxxxxxxxxx
INVALID USERNAME: more than 20 characters
> Steve
Username created!
> Bob: Hey!
> Hey Bob!
> Bob: How are you?
> Eh, been better? Is Joe on?
> Joe: Don't forget about me!
> Joe: I am here
> yeah yeah...
> /help
************HELP************
/exit - exit client
/msg [clientName] - private message another client
/tictactoe [clientName] - start tictactoe match with another client
/tictactoe team [clientName] - add client to your team for match
************HELP************
> /exit
ATryjan:client-server-chatroom aetryjan$
————————————
SERVER DEMO:
CLIENT VIEW
ATryjan:client-server-chatroom aetryjan$ ./client.o localhost 51718
> Please enter a username: Steve
Username created!
> Henry: Hey Steve!
> Hey Henry! How's it hangin'?
> Henry: Just relaxing you know the usual
> Ah! Well, I'm thinking about how great Koby and Chris are at their jobs ;)
> Henry: Eh they aren't that special
>
SERVER VIEW
ATryjan:client-server-chatroom aetryjan$ ./server.o 51718
Username Provided: Henry
Username Provided: Steve
Here is the message: Hey Steve!
Here is the message: Hey Henry! How's it hangin'?
Here is the message: Just relaxing you know the usual
Here is the message: Ah! Well, I'm thinking about how great Koby and Chris are at their jobs ;)
Here is the message: Eh they aren't that special
Messaging and online demo:
____________________________
david@dazzle:client-server-chatroom\ $ ./client.o localhost 51717
> Please enter a username: Bob
Username created!
> Hello
> Joe: Hi
> /msg Joe this is a test
> /online
***********ONLINE***********
- Bob 1
- Joe 1
> DM from Joe: Gotta go see ya
> /online
***********ONLINE***********
- Bob 1
- Joe 0
>