1 public class ChatThread extends Thread {
7 public ChatThread(Socket sock, RoomObject ro) {
13 sock.write("Please choose a chatroom".getBytes());
20 public void ReadRequest() {
21 while (!processRead())
25 private void ProcessRoom() {
29 public void Message() {
30 byte buffer[]=new byte[1024];
31 int length=sock.read(buffer);
33 String st=(new String(buffer)).subString(0, length);
34 room.sendToRoom(this, st.getBytes());
38 public boolean processRead() {
39 byte buffer[]=new byte[1024];
40 int length=sock.read(buffer);
41 String st=new String(buffer);
42 String curr=st.subString(0, length);
43 if (roomrequest!=null) {
44 StringBuffer sb=new StringBuffer(roomrequest);
49 if (roomrequest.indexOf("\n")>=0) {
54 public void processRoom(RoomObject ro) {
55 ro.getChatRoom(roomrequest).addParticipant(this);