aboutsummaryrefslogtreecommitdiff
path: root/CS2452/chatThreaded/T1.java
blob: 6fd8e068e71826b934d36a25a5178c750979398e (plain)
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
import java.util.*;
import java.io.*;
import java.net.*;


class T1 extends Thread
{
	Socket s;

	public T1(Socket socket)
	{
		s = socket;
	}
	public void run()
	{
		BufferedReader tr = new BufferedReader(new InputStreamReader(System.in));
		
		try
		{
			BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
			
			while(true)	
			{
				bw.write(tr.readLine());
				bw.newLine();
				bw.flush();
			}
			}catch(Exception e){
				e.printStackTrace();
		}
	}
}