forked from vedantDalal/gitWorkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTICTAC_client.java
More file actions
48 lines (32 loc) · 912 Bytes
/
TICTAC_client.java
File metadata and controls
48 lines (32 loc) · 912 Bytes
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
import java.net.*;
import java.io.*;
class TICTAC_client
{
static TICTAC_client tc = new TICTAC_client();
static NticTac obj1 = new NticTac("X",tc);
public static void main(String args[]) throws Exception
{
obj1.setSize(400,400);
obj1.setVisible(true);
}
void send(String idx_chance)
{
try
{
Socket s = new Socket("localhost",9000);
OutputStream os = s.getOutputStream();
OutputStreamWriter osw = new OutputStreamWriter(os);
PrintWriter pw = new PrintWriter(osw,true);
idx_chance = obj1.getIndexChance();
pw.println(idx_chance);
InputStream is = s.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
System.out.println("The answer="+br.readLine());
}
catch(Exception e1)
{
System.out.println(e1);
}
}
}