Rev 82 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 82 | Rev 149 | ||
---|---|---|---|
1 | import java.io.*; |
1 | import java.io.*; |
2 | import javax.microedition.io.*; |
2 | import javax.microedition.io.*; |
3 | 3 | ||
4 | public class MKProxy |
4 | public class MKProxy |
5 | implements Runnable |
5 | implements Runnable |
6 | { |
6 | { |
- | 7 | ||
- | 8 | public boolean connected; |
|
- | 9 | public String url; |
|
7 | 10 | ||
8 | public String err_str="none"; |
11 | public String err_str="none"; |
9 | StreamConnection connection; |
12 | StreamConnection connection; |
10 | 13 | ||
11 | public java.io.InputStream reader; |
14 | public java.io.InputStream reader; |
12 | public java.io.OutputStream writer; |
15 | public java.io.OutputStream writer; |
13 | 16 | ||
14 | public MKProxy(String url) |
17 | public void connect(String url_) |
- | 18 | { |
|
- | 19 | url=url_; |
|
15 | { |
20 | |
16 | try |
21 | try |
17 | { |
22 | { |
18 | connection = (StreamConnection) Connector.open(url, Connector.READ_WRITE); |
23 | connection = (StreamConnection) Connector.open(url, Connector.READ_WRITE); |
19 | reader=connection.openInputStream(); |
24 | reader=connection.openInputStream(); |
20 | writer=connection.openOutputStream(); |
25 | writer=connection.openOutputStream(); |
- | 26 | connected=true; |
|
- | 27 | } |
|
- | 28 | ||
- | 29 | catch (Exception e) |
|
- | 30 | { |
|
- | 31 | // err_str=e.toString(); |
|
- | 32 | // this=null; |
|
- | 33 | ||
- | 34 | connected=false; |
|
21 | 35 | } |
|
- | 36 | ||
22 | 37 | } |
|
23 | } |
38 | |
- | 39 | public void write(int input) |
|
24 | catch (Exception e) |
40 | { |
- | 41 | if (connected) |
|
- | 42 | try{ writer.write(input); |
|
25 | { |
43 | if (input==13) writer.flush(); |
- | 44 | ||
26 | err_str=e.toString(); |
45 | } |
27 | } |
46 | catch(Exception e) { connected=false; } |
28 | } |
47 | } |
29 | 48 | ||
30 | public void run() |
49 | public void run() |
31 | { |
50 | { |
32 | } |
51 | } |
33 | 52 | ||
34 | } |
53 | } |
35 | 54 |