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