-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConsumerResponse.java
55 lines (50 loc) · 1 KB
/
ConsumerResponse.java
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
49
50
51
52
53
54
55
import java.io.ObjectInputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Vector;
public class ConsumerResponse extends Thread
{
ServerSocket ss;
Socket s;
ObjectInputStream ois;
public ConsumerResponse(int portno)
{
try
{
ss=new ServerSocket(portno);
}
catch (Exception e)
{
e.printStackTrace();
}
start();
}
public void run()
{
try
{
while(true)
{
s=ss.accept();
ois=new ObjectInputStream(s.getInputStream());
String data=(String)ois.readObject();
String[] parts = data.split("&&");
String part1 = parts[0]; // 004
String part2 = parts[1]; // 034556
if(part2.equals("dependent")) {
MainCon.drestext.setText(""+part1);
}
if(part2.equals("independent")) {
MainCon.irestext.setText(""+part1);
}
if(part2.equals("filter")) {
MainCon.frestext.setText(""+part1);
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}