Author: klystr
(2009/12/07 11:19) About 2 years ago
15
private Socket socket;
16
private PrintWriter outPutWriter;
17
private BufferedReader inputReader;
18
private String inputMessage;
19
private HTTPApp2QChannel httpObject;
20
21
public HTTPPostConnection(Socket accept, HTTPApp2QChannel httpObject) {
6
7
@Override
8
public void run() {
9
10
}
11
12
1
package hanze.ga.wt3.socket;
2
3
import java.io.PrintWriter;
4
import java.net.Socket;
5
import hanze.ga.wt3.channels.Q2App;
public class SocketQ2AppChannel extends Q2App {
try {
13
while (true) {
14
this.Q2socket();
Thread.sleep(3000);
} catch (Exception e) {
e.printStackTrace();
22
private void Q2socket() {
23
while (this.getSourceQueue().getSize() > 0) {
24
this.sendToSocket(this.getSourceQueue().pollFromQueue());
25
26
27
28
private void sendToSocket(String queueItem) {
29
30
// Open socket
31
Socket socket = new Socket(this.getChannelIp(), this.getChannelPort());
32
PrintWriter outPutWriter = new PrintWriter(socket.getOutputStream(), true);
33
34
// Schrijf queueItem naar socket
35
outPutWriter.write(queueItem);
36
37
// Sluiten
38
outPutWriter.close();
39
socket.close();
40
41
42
43
44
45
private String inputMessage;public HTTPPostConnection(Socket accept, HTTPApp2QChannel httpObject) {public HTTPPostConnection(Socket accept, HTTPApp2QChannel httpObject) {public void run() {public void run() {public class SocketQ2AppChannel extends Q2App {public class SocketQ2AppChannel extends Q2App {public void run() {public void run() {try {while (true) {} catch (Exception e) {private void Q2socket() {while (this.getSourceQueue().getSize() > 0) {private void sendToSocket(String queueItem) {try {} catch (Exception e) {