43 |
|
_queue = queue; |
44 |
|
// setup the reader & writer |
45 |
|
_socketIn = new BufferedReader(new InputStreamReader(_socket.getInputStream())); |
46 |
< |
_socketOut = new PrintWriter(_socket.getOutputStream()); |
46 |
> |
_socketOut = new PrintWriter(_socket.getOutputStream(), true); |
47 |
|
_logger.write(toString(), Logger.SYSINIT, "created"); |
48 |
|
} |
49 |
|
|
64 |
|
inBound = _socketIn.readLine(); |
65 |
|
if(!inBound.equals("HEARTBEAT")) { |
66 |
|
_socketOut.println("ERROR"); |
67 |
– |
_socketOut.flush(); |
67 |
|
throw new IOException("protocol error - expecting:HEARTBEAT got:" + inBound); |
68 |
|
} else { |
69 |
|
_socketOut.println("OK"); |
71 |
– |
_socketOut.flush(); |
70 |
|
} |
71 |
|
|
72 |
|
inBound = _socketIn.readLine(); |
73 |
|
if(!inBound.equals("CONFIG")) { |
74 |
|
_socketOut.println("ERROR"); |
77 |
– |
_socketOut.flush(); |
75 |
|
throw new IOException("protocol error - expecting:CONFIG got:" + inBound); |
76 |
|
} else { |
77 |
|
_socketOut.println("OK"); |
81 |
– |
_socketOut.flush(); |
78 |
|
} |
79 |
|
|
80 |
|
inBound = _socketIn.readLine(); |
81 |
|
filelist = inBound; |
82 |
|
_socketOut.println("OK"); |
87 |
– |
_socketOut.flush(); |
83 |
|
|
84 |
|
inBound = _socketIn.readLine(); |
85 |
|
lastModified = inBound; |
92 |
|
else { |
93 |
|
_socketOut.println("OK"); |
94 |
|
} |
100 |
– |
_socketOut.flush(); |
95 |
|
|
96 |
|
inBound = _socketIn.readLine(); |
97 |
|
if(!inBound.equals("ENDHEARTBEAT")) { |
98 |
|
_socketOut.println("ERROR"); |
105 |
– |
_socketOut.flush(); |
99 |
|
throw new IOException("protocol error - expecting:ENDHEARTBEAT got:" + inBound); |
100 |
|
} else { |
101 |
|
_socketOut.println("OK"); |
109 |
– |
_socketOut.flush(); |
102 |
|
} |
103 |
|
|
104 |
|
String date = new Long(System.currentTimeMillis()).toString(); |
112 |
|
_logger.write(toString(), Logger.ERROR, "ERROR: " + e.getMessage()); |
113 |
|
} |
114 |
|
|
123 |
– |
_socketOut.flush(); |
115 |
|
// Disconnect streams & socket |
116 |
|
try { |
117 |
|
_socketIn.close(); |