Page 94 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 94
268. socket.getInetAddress().getHostAddress();
269. }
270.
271. /**
272. * @메소드명 : send
273. * @변수 str : 전송할 데이터
274. * @설명 : 소켓의 dataOutputStream으로 데이터 전송
275. */
276. public void send(String str) throws IOException {
277. dataOutputStream.writeUTF(str);
278. dataOutputStream.flush();
279. }
280.
281. /**
282. * @메소드명 : removeSelf
283. * @변수 busstopList : 각 정류장에서 내린 인원 제거
284. * @설명 : 소켓의 dataOutputStream으로 데이터 전송
285. */
286. private void removeSelf(ArrayList<Socket>
287. busstopList) {
288. String self = getSockName();
289. for (int i = 0; i < busstopList.size(); i++) {
290. if (busstopList.get(i).getInetAddress
291. ().getHostAddress().equals(self)) {
292. busstopList.remove(i);
293. }
294. }
295. }
296.
297. /**
298. * @메소드명 : run
299. * @설명 : 승차한 인원을 데이터베이스에 저장하는 메소드
300. */
301. @Override
302. public void run() {
303. try {
304.
305. //새로 승차한 인원과 내릴 정류장을 변경한 승객을 찾아 저장 및 수정
306. String str =
307. dataInputStream.readUTF();
308. if(Test.findit(getSockName())){
- 87 -