Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2b3a6cb

Browse files
Content updated Client site programming...
1 parent 9fba5c3 commit 2b3a6cb

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

‎Client_Side/src/Controller/Client_Room.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.net.URL;
2828
import java.util.ResourceBundle;
2929

30+
import static Controller.Login_Signup.users;
3031
public class Client_Room extends Thread implements Initializable {
3132
public Label clientName;
3233
public Button profileBtn;
@@ -75,6 +76,33 @@ public void connectSocket(){
7576
e.printStackTrace();
7677
}
7778
}
79+
@Override
80+
public void run() {
81+
try {
82+
while (true) {
83+
String msg = reader.readLine();
84+
String[] tokens = msg.split(" ");
85+
String cmd = tokens[0];
86+
System.out.println(cmd);
87+
StringBuilder fulmsg = new StringBuilder();
88+
for (int i = 1; i < tokens.length; i++) {
89+
fulmsg.append(tokens[i]);
90+
}
91+
System.out.println(fulmsg);
92+
if (cmd.equalsIgnoreCase(Login_Signup.username + ":")) {
93+
continue;
94+
} else if (fulmsg.toString().equalsIgnoreCase("bye")) {
95+
break;
96+
}
97+
msgRoom.appendText(msg + "\n");
98+
}
99+
reader.close();
100+
writer.close();
101+
socket.close();
102+
} catch (Exception e) {
103+
e.printStackTrace();
104+
}
105+
}
78106

79107
public void handleProfileBtn(ActionEvent event) {
80108

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /