Subversion Repositories Projects

Rev

Rev 82 | Only display areas with differences | Ignore 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();
21
       
-
 
22
 
-
 
-
 
26
                connected=true;
23
            }
27
            }
-
 
28
       
24
        catch (Exception e)
29
        catch (Exception e)
25
            {
30
            {
26
                err_str=e.toString();
31
                //              err_str=e.toString();
-
 
32
                //              this=null;
-
 
33
 
-
 
34
                connected=false;
-
 
35
            }
-
 
36
 
-
 
37
    }
-
 
38
 
-
 
39
    public void write(int input)
-
 
40
    {
-
 
41
        if (connected)
-
 
42
            try{ writer.write(input);
-
 
43
            if (input==13) writer.flush();
-
 
44
 
27
            }
45
            }
-
 
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