Skip to content

Commit 9e80ee9

Browse files
committed
added some small modification for the UI
1 parent 0f231fa commit 9e80ee9

File tree

10 files changed

+14
-17
lines changed

10 files changed

+14
-17
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

src/AdminClient/AdminClient.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ public static void main(String[] args) throws IOException {
2727
out.println(groupSectionID);
2828
String messageInfo = null;
2929
String messageContent = null;
30-
while ((messageInfo = massageReader.readLine()) != null) {
30+
if ((messageInfo = massageReader.readLine()) != null) {
3131
System.out.println(messageInfo);
32-
BufferedReader consoleReader = new BufferedReader(new InputStreamReader(System.in));
33-
messageContent = consoleReader.readLine();
34-
if (!"end".equals(messageContent)) {
35-
out.println(messageContent);
36-
37-
}else{
38-
out.println(messageContent);
39-
break;
32+
while (true) {
33+
BufferedReader consoleReader = new BufferedReader(new InputStreamReader(System.in));
34+
messageContent = consoleReader.readLine();
35+
if (!"end".equals(messageContent)) {
36+
out.println(messageContent);
37+
38+
} else {
39+
out.println(messageContent);
40+
break;
41+
}
4042
}
4143
}
4244

src/Server/Server.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public void run() {
3838
ServerSocket ss = new ServerSocket(SUBSCRIBE_PORT);
3939
while (true) {
4040
new SUBSCRIBE_Service(ss.accept(),600 + totalClients++,groupsArrayList).start();
41+
System.out.println("Total Number of clients = "+ totalClients);
4142
}
4243
} catch (IOException e) {
4344
e.printStackTrace();
@@ -75,14 +76,12 @@ public void run() {
7576
BufferedReader groupBR = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
7677
String groupSectionID = groupBR.readLine();
7778
DatagramSocket clientSocket = new DatagramSocket();
79+
String str = "What is the message to be broadcast?";
80+
out.println(str);
7881
while (groupSectionID.equals("1")) {
79-
String str = "What is the message to be broadcast?";
80-
out.println(str);
8182
String message = null;
8283
Groups Section1 =groupsArrayList.get(0);
83-
System.out.println("Sending data to all client in this group");
8484
if ((message=groupBR.readLine())!= null && !message.equals("end")){
85-
System.out.println(message);
8685
// convert to byte
8786
byte[] sendData = new byte[1024];
8887
sendData=message.getBytes();
@@ -99,13 +98,9 @@ public void run() {
9998
}
10099
}
101100
while (groupSectionID.equals("2")) {
102-
String str = "What is the message to be broadcast?";
103-
out.println(str);
104101
String message = null;
105102
Groups Section2 =groupsArrayList.get(1);
106-
System.out.println("Sending data to all client in this group");
107103
if ((message=groupBR.readLine())!= null && !message.equals("end")){
108-
System.out.println(message);
109104
// convert to byte
110105
byte[] sendData = new byte[1024];
111106
sendData=message.getBytes();

0 commit comments

Comments
 (0)